Bug#960442: apt-listbugs: after Ctrl-C apt fails exit 2 even though apt-listbugs exit 0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#960442: apt-listbugs: after Ctrl-C apt fails exit 2 even though apt-listbugs exit 0

Jochen Sprickerhof-5
Package: apt-listbugs
Version: 0.1.31
Severity: normal

Hi,

this is probably rather an apt bug and apt-listbugs is only the culprit,
so feel free to reassign if you agree.

Symptom: Sometimes the BTS is slow and apt-listbugs stops in "Retrieving
bug reports...". Hitting Ctrl-C here results in:

| # apt install zsh
| Reading package lists... Done
| Building dependency tree
| Reading state information... Done
| Suggested packages:
|   zsh-doc
| The following NEW packages will be installed:
|   zsh
| 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
| Need to get 0 B/901 kB of archives.
| After this operation, 2501 kB of additional disk space will be used.
| Retrieving bug reports... 0%^CInterrupted
|  Fail
| Error retrieving bug reports from the server with the following error message:
| E: exit
| It could be because your network is down, or because of broken proxy servers, or the BTS server itself is down. Check network configuration and try again
| Retry downloading bug information? [Y/n] n
| Continue the installation anyway? [y/N] y
| Retrieving bug reports... Done
| Parsing Found/Fixed information... Done
| E: Sub-process /usr/bin/apt-listbugs apt received signal 2.
| E: Failure running script /usr/bin/apt-listbugs apt

i.e. apt-listbugs asks if apt should continue to install bug apt fails
afterwards anyhow.

Steps to reproduce (as root):
# echo 127.0.0.1 bugs.debian.org >> /etc/hosts
# nc -l -p 80
# apt install zsh  # or any other package not installed

Doing pkill -INT apt-listbugs instead of Ctrl-C works, but that means
opening a new root shell.

I tried debugging this the process tree and as far as I see Ctrl-C is
caught by the sh process running apt-listbugs.

I see two ways to solve this:

- Don't ask the questions in case apt-listbugs is killed by the parent
  (and maybe print that one should kill apt-listbugs as a workaround).
- Get the shell started by apt to not catch the Ctrl-C.
  I tried to do that but didn't find a way. apt set's the INT signal
  handler to ignore before calling sh (apt-pkg/deb/dpkgpm.cc:427) but
  dash gets the signal, still. I tried to trap '' INT in
  apt.conf.d/10apt-listbugs but that didn't work out (APT_HOOK_INFO_FD
  not set).
  Reading https://unix.stackexchange.com/a/165715 there seems to be an
  option to set the active process group, but I didn't find a way to
  make it work.

The only related bug I found is #214141.

Cheers Jochen

-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages apt-listbugs depends on:
ii  apt             2.1.1
ii  ruby            1:2.7+1
ii  ruby-debian     0.3.10+b3
ii  ruby-gettext    3.3.3-2
ii  ruby-soap4r     2.0.5-4
ii  ruby-unicode    0.4.4-2+b11
ii  ruby-xmlparser  0.7.3-3+b4

Versions of packages apt-listbugs recommends:
pn  ruby-httpclient  <none>
pn  s6               <none>

Versions of packages apt-listbugs suggests:
ii  chromium [www-browser]  81.0.4044.92-1
ii  firefox [www-browser]   76.0-2
ii  lynx [www-browser]      2.9.0dev.5-1
ii  reportbug               7.6.0
ii  sensible-utils          0.0.12+nmu1
ii  surf [www-browser]      2.0+git20190208-2
ii  w3m [www-browser]       0.5.3-38
ii  xdg-utils               1.1.3-2

-- no debconf information

Reply | Threaded
Open this post in threaded view
|

Bug#960442: apt-listbugs: after Ctrl-C apt fails exit 2 even though apt-listbugs exit 0

Francesco Poli (wintermute)
On Tue, 12 May 2020 16:50:27 +0200 Jochen Sprickerhof wrote:

> Package: apt-listbugs
> Version: 0.1.31
> Severity: normal
>
> Hi,

Hello Jochen,
thanks for your bug report!

>
> this is probably rather an apt bug and apt-listbugs is only the culprit,
> so feel free to reassign if you agree.

It's most probably a bug that has to be fixed in apt.

[...]
> The only related bug I found is #214141.

Could you please read bug [#832593]?

It's a rather long read, I admit, but I really suspect that it
describes the same issue you are experiencing.
To be more precise, you seem to be experiencing the current
[incarnation] of [#832593].

Please note that [#832593] is still open: the final patch that should
let apt use bash in stead of sh seems to be still unapplied to
apt/2.1.1 ...

[#832593]: <https://bugs.debian.org/832593>
[incarnation]: <https://bugs.debian.org/832593#48>

Unless you disagree, I am going to reassign your bug report to apt and
merge it with [#832593].
Please let me know.


--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Bug#960442: apt-listbugs: after Ctrl-C apt fails exit 2 even though apt-listbugs exit 0

Francesco Poli (wintermute)
In reply to this post by Jochen Sprickerhof-5
Control: forcemerge 832593 -1


On Wed, 13 May 2020 22:48:39 +0200 Francesco Poli wrote:

[...]
> I am going to merge this [new bug] with [#832593].

Here's the merging...

--
 http://www.inventati.org/frx/
 There's not a second to spare! To the laboratory!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

attachment0 (849 bytes) Download Attachment