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 via email to