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

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

    <bug>
          <bug_id>18343</bug_id>
          
          <creation_ts>2008-12-25 11:03:07 +0300</creation_ts>
          <short_desc>Сделать выход по ^D из apt-shell</short_desc>
          <delta_ts>2009-05-10 09:33:59 +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>patch</keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrey Rahmatullin">wrar</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>boyarsh</cc>
    
    <cc>dottedmag</cc>
    
    <cc>evg</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
    
    <cc>iv</cc>
    
    <cc>ldv</cc>
    
    <cc>led</cc>
    
    <cc>mike</cc>
    
    <cc>php-coder</cc>
    
    <cc>placeholder</cc>
    
    <cc>rider</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>83411</commentid>
    <comment_count>0</comment_count>
    <who name="Andrey Rahmatullin">wrar</who>
    <bug_when>2008-12-25 11:03:07 +0300</bug_when>
    <thetext>Сделайте выход из apt-shell по ^D, а то без него неудобно.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83678</commentid>
    <comment_count>1</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2008-12-30 22:37:48 +0300</bug_when>
    <thetext>Ctrl+D в readline используется для удаления текущего символа под курсором. Если бы apt-shell не использовал libreadline, то можно было бы вручную проверять на EOF и выходить.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83682</commentid>
    <comment_count>2</comment_count>
    <who name="Mikhail Gusarov">dottedmag</who>
    <bug_when>2008-12-30 22:45:51 +0300</bug_when>
    <thetext>Слава, см. документацию на readline: rhttp://tiswww.case.edu/php/chet/readline/readline.html#SEC16

&quot;delete-char (C-d) 
Delete the character at point. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to delete-char, then return EOF.&quot;

http://tiswww.case.edu/php/chet/readline/readline.html#SEC24

&quot;If readline encounters an EOF while reading the line, and the line is empty at that point, then (char *)NULL is returned.&quot;

В apt-shell.cc:

line = readline(_config-&gt;Find(&quot;APT::Shell::Prompt&quot;, &quot;apt&gt; &quot;).c_str());
if (!line || !*line) {
   free(line);
   continue;
}

Так что здесь всего лишь надо случай if(!line) рассмотреть отдельно.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83683</commentid>
    <comment_count>3</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2008-12-30 22:51:11 +0300</bug_when>
    <thetext>2dottedmag@: о, спасибо. Попробую сделать.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83685</commentid>
    <comment_count>4</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2008-12-30 23:15:09 +0300</bug_when>
    <thetext>Вот предлагаемый патч:
http://git.altlinux.org/people/php_coder/packages/apt.git?p=apt.git;a=commitdiff;h=7956d444db6d6c92ec675a2b00926b166672c2da</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83709</commentid>
    <comment_count>5</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2008-12-31 16:47:26 +0300</bug_when>
    <thetext>*** Bug 6264 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83802</commentid>
    <comment_count>6</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2009-01-02 03:25:10 +0300</bug_when>
    <thetext>0.5.15lorg2-alt22.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83836</commentid>
    <comment_count>7</comment_count>
      <attachid>3182</attachid>
    <who name="Ivan A. Melnikov">iv</who>
    <bug_when>2009-01-03 16:04:14 +0300</bug_when>
    <thetext>Created attachment 3182
add feedback to Ctrl-D


Огромное спасибо за проделанную работу!

Однако, есть небольшое замечание. При нажатии Ctrl-D не выполняется переход на новую строку, в результате чего получается следующее:
apt&gt; [root@deimos ~]#

Как-то... не эстетично ;)

Например, bash делает так:
http://git.altlinux.org/people/ldv/packages/bash.git?p=bash.git;a=blob;f=bash/builtins/exit.def;h=ddaa5d315cd44f215a0b7e928f7f369ec9106a1a;hb=13bd4196973ac0d4d299b2b24ffb22efbae6d055#l63

Предлагаю дополненный одной строчкой патч, который делает практически также, только на C++.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83841</commentid>
    <comment_count>8</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2009-01-03 18:11:19 +0300</bug_when>
    <thetext>(In reply to comment #7)
&gt; Однако, есть небольшое замечание. При нажатии Ctrl-D не выполняется переход на
&gt; новую строку, в результате чего получается следующее:
&gt; apt&gt; [root@deimos ~]#

apt&gt; %
[c0der@rock ~]$

У меня в  zsh вот так, поэтому я и не заметил неэстетичности.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83978</commentid>
    <comment_count>9</comment_count>
    <who name="">led</who>
    <bug_when>2009-01-08 20:49:06 +0300</bug_when>
    <thetext>(In reply to comment #7)
 
&gt; Предлагаю дополненный одной строчкой патч, который делает практически
&gt; также, только на C++.

Присоединяюсь к пожеланию: нужно убрать эту неэстетичность. достаточно:
c1out &lt;&lt; endl;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83979</commentid>
    <comment_count>10</comment_count>
    <who name="">led</who>
    <bug_when>2009-01-08 20:50:10 +0300</bug_when>
    <thetext>лучше всё же зафиксить</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84054</commentid>
    <comment_count>11</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2009-01-09 21:14:08 +0300</bug_when>
    <thetext>(In reply to comment #10)
&gt; лучше всё же зафиксить

Будет исправлено в 0.5.15lorg2-alt22.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84215</commentid>
    <comment_count>12</comment_count>
    <who name="Slava Semushin">php-coder</who>
    <bug_when>2009-01-11 00:09:59 +0300</bug_when>
    <thetext>Патч принят апстримом: http://apt-rpm.org/scm/?p=apt.git;a=commitdiff;h=c4822097f9a52a5d498640e5d3a16c6fd555b5bc</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>3182</attachid>
            <date>2009-01-03 16:04:14 +0300</date>
            <delta_ts>2009-01-03 16:04:14 +0300</delta_ts>
            <desc>add feedback to Ctrl-D</desc>
            <filename>apt-0.5.15lorg2-alt-apt-shell_quit_by_ctrld.patch</filename>
            <type>text/plain</type>
            <size>759</size>
            <attacher name="Ivan A. Melnikov">iv</attacher>
            
              <data encoding="base64">Cmh0dHBzOi8vYnVnemlsbGEuYWx0bGludXgub3JnL3Nob3dfYnVnLmNnaT9pZD0xODM0MwoKZGlm
ZiAtLWdpdCBhL2FwdC9jbWRsaW5lL2FwdC1zaGVsbC5jYyBiL2FwdC9jbWRsaW5lL2FwdC1zaGVs
bC5jYwppbmRleCA2ZDFmNzY3Li5mZjRmZDJkIDEwMDY0NAotLS0gYS9hcHQvY21kbGluZS9hcHQt
c2hlbGwuY2MKKysrIGIvYXB0L2NtZGxpbmUvYXB0LXNoZWxsLmNjCkBAIC00NDc3LDEwICs0NDc3
LDE4IEBAIGludCBtYWluKGludCBhcmdjLGNvbnN0IGNoYXIgKmFyZ3ZbXSkKICAgICAgIH0KICAg
ICAgIAogICAgICAgbGluZSA9IHJlYWRsaW5lKF9jb25maWctPkZpbmQoIkFQVDo6U2hlbGw6OlBy
b21wdCIsICJhcHQ+ICIpLmNfc3RyKCkpOwotICAgICAgaWYgKCFsaW5lIHx8ICEqbGluZSkgewot
CSBmcmVlKGxpbmUpOwotCSBjb250aW51ZTsKKyAgICAgIGlmICghbGluZSkgeworICAgICAgICAv
LyBleGl0IGZyb20gc2hlbGwgYnkgQ3RybC1ECisgICAgICAgICBjMW91dCA8PCAicXVpdCIgPDwg
ZW5kbDsKKyAgICAgICAgIF9jb25maWctPlNldCgicXVpdCIsICJ0cnVlIik7CisgICAgICAgICBj
b250aW51ZTsKKyAgICAgIH0KKworICAgICAgaWYgKCEqbGluZSkgeworICAgICAgICAgZnJlZShs
aW5lKTsKKyAgICAgICAgIGNvbnRpbnVlOwogICAgICAgfQorCiAgICAgICBhZGRfaGlzdG9yeShs
aW5lKTsKIAogICAgICAgbGFyZ2MgPSAxOyAvLyBDb21tYW5kTGluZS5QYXJzZSgpIGlnbm9yZXMg
dGhlIGZpcnN0IG9wdGlvbi4K
</data>

          </attachment>
      

    </bug>

</bugzilla>