<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>13877</bug_id>
          
          <creation_ts>2008-01-05 08:20:10 +0300</creation_ts>
          <short_desc>apt-shell crashes if one answers &quot;no&quot; to commit</short_desc>
          <delta_ts>2014-01-09 22:44:57 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>apt</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>boyarsh</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>lav</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>shakirov</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>60361</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2008-01-05 08:20:11 +0300</bug_when>
    <thetext>apt-0.5.15lorg2-alt18

Looks like https://bugzilla.altlinux.org/show_bug.cgi?id=4707#c1 .
Steps to Reproduce:
Valid for any package:

# ftp_proxy= http_proxy= apt-shell 
Reading Package Lists... Done
Building Dependency Tree... Done
Welcome to the APT shell. Type &quot;help&quot; for more information.
apt&gt; install libnotify-devel 
apt&gt; commit 
The following NEW packages will be installed:
  libnotify-devel
0 upgraded, 1 newly installed, 0 removed and 1234 not upgraded.
Need to get 5710B of archives.
After unpacking 8343B of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114920</commentid>
    <comment_count>1</comment_count>
    <who name="Lenar Shakirov">shakirov</who>
    <bug_when>2010-11-06 13:50:00 +0300</bug_when>
    <thetext>Воспроизводится:

# rpm -q apt rpm
apt-0.5.15lorg2-alt33
rpm-4.0.4-alt100.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123760</commentid>
    <comment_count>2</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2011-08-08 22:32:59 +0400</bug_when>
    <thetext>Reproduced with:

apt-0.5.15lorg2-alt38
rpm-4.0.4-alt100.24</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131404</commentid>
    <comment_count>3</comment_count>
    <who name="Vitaly Lipatov">lav</who>
    <bug_when>2012-05-23 19:18:40 +0400</bug_when>
    <thetext>Это ужасно неприятная бага, мешающая методом подбора подобрать хорошее решение.
Там специально написан такой код, который вызывает завершение просто при ответе &quot;нет&quot;.

Предлагаю внести следующее исправление (на себе проверил):

diff --git a/apt/cmdline/apt-shell.cc b/apt/cmdline/apt-shell.cc
index 1dcfc06..c26885f 100644
--- a/apt/cmdline/apt-shell.cc
+++ b/apt/cmdline/apt-shell.cc
@@ -1101,8 +1101,7 @@ bool InstallPackages(CacheFile &amp;Cache,bool ShwKept,bool Ask = true,
       c2out &lt;&lt; flush;
       if (AnalPrompt(Prompt) == false)
       {
-        c2out &lt;&lt; _(&quot;Abort.&quot;) &lt;&lt; endl;
-        exit(1);
+        return true;
       }     
    }
    else
@@ -1120,8 +1119,7 @@ bool InstallPackages(CacheFile &amp;Cache,bool ShwKept,bool Ask = true,
         
            if (YnPrompt() == false)
            {
-              c2out &lt;&lt; _(&quot;Abort.&quot;) &lt;&lt; endl;
-              exit(1);
+              return true;
            }     
         }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131406</commentid>
    <comment_count>4</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2012-05-23 19:22:49 +0400</bug_when>
    <thetext>Может быть, любое другое продолжение работы apt-shell после отказа от коммита переводит apt-shell в неконсистентное состояние?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131407</commentid>
    <comment_count>5</comment_count>
    <who name="Vitaly Lipatov">lav</who>
    <bug_when>2012-05-23 20:25:01 +0400</bug_when>
    <thetext>(В ответ на комментарий №4)
&gt; Может быть, любое другое продолжение работы apt-shell после отказа от коммита
&gt; переводит apt-shell в неконсистентное состояние?

Из функции InstallPackage много раз выходят с помощью return. К тому же на этом этапе ничего ещё дельного не произошло.

Так что я считаю, что никакого неконсистентного состояния там не возникает. На себе проверил.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131435</commentid>
    <comment_count>6</comment_count>
    <who name="Repository Robot">repository-robot</who>
    <bug_when>2012-05-24 22:11:47 +0400</bug_when>
    <thetext>apt-0.5.15lorg2-alt41 -&gt; sisyphus:

* Thu May 24 2012 Dmitry V. Levin &lt;ldv@altlinux&gt; 0.5.15lorg2-alt41
- apt-get, apt-shell: when a package could not be found, print the
  unmangled package request string (by Igor Vlasenko; closes: #27364).
- apt-shell: do not abort when commit is cancelled (closes: #13877);
  Unlike one may suppose, this change will not cause the cache of
  accumulated changes to be cleared by cancelled &quot;commit&quot; operation, but
  this is exactly what Vitaly Lipatov has proposed in his comments to #13877.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131464</commentid>
    <comment_count>7</comment_count>
    <who name="Vitaly Lipatov">lav</who>
    <bug_when>2012-05-26 15:16:13 +0400</bug_when>
    <thetext>Спасибо!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>144518</commentid>
    <comment_count>8</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2014-01-09 22:44:57 +0400</bug_when>
    <thetext>Спасибо!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>