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

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Jochen Sprickerhof
Date:
2026-01-02 23:19:02 UTC
Severity:
normal
#960442#5
Date:
2020-05-12 14:50:27 UTC
From:
To:
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

#960442#10
Date:
2020-05-12 16:24:47 UTC
From:
To:
Hello Jochen,
thanks for your bug report!

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

[...]

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.

#960442#15
Date:
2020-05-13 20:48:39 UTC
From:
To:
On Tue, 12 May 2020 18:24:47 +0200 Francesco Poli wrote:

[...]

Dear Jochen, I am reassigning the bug report right now.



Dear APT Development Team,
I received a [new bug] report for apt-listbugs about the behavior after
Ctrl+C.

[new bug]: <https://bugs.debian.org/960442>

The described behavior seems to be consistent with the current
[incarnation] of bug [#832593].

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

Do I understand correctly that the patch mentioned in [message #85] has
not been applied to apt yet?
Could you please explain why?

[message #85]: <https://bugs.debian.org/832593#85>

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

#960442#28
Date:
2020-05-13 21:01:02 UTC
From:
To:
On Wed, 13 May 2020 22:48:39 +0200 Francesco Poli wrote:

[...]

Here's the merging...

#960442#37
Date:
2024-10-11 22:06:52 UTC
From:
To:
On Wed, 13 May 2020 22:48:39 +0200 Francesco Poli wrote:

[...]
[...]

Dear APT Development Team,
the following command produces an empty output:

  $ apt-config dump | grep Dir::Bin:sh

I have:

  $ apt --version
  apt 2.9.8 (amd64)

Do I understand correctly that the patch mentioned 8 years ago in
[message #85] has not been applied to apt yet?
Could you please explain why?

I still see the problematic behaviour when [Ctrl+C] during the
apt-listbugs hook...
I would really love to see this bug solved once and for all.

Thanks for your time.

#960442#42
Date:
2026-01-02 23:07:19 UTC
From:
To:
Dear APT Development Team,
I still hear from users that experience the problematic behavior when
[Ctrl+C] is pressed during the apt-listbugs hook...

May I get some news about the patch mentioned more than 9 years ago?

Please let me know.
Thanks for your time and understanding.