Control: reassign -1 apt 1.3~pre2
Control: affects -1 + apt-listbugs
On Fri, 29 Jul 2016 19:41:28 +0200 Francesco Poli wrote:
> Hence, I am suspecting that the misbehavior has something to do with
> the way the package manager invokes its hooks...
[...]
>
> I am Cc-ing the APT Development Team: could any of you take a look at
> bug #832593, please?
> Any ideas on why a hook that traps SIGINT runs into troubles, when it
> catches such signal, but does not immediately exit?
Hello again, APT Development Team.
I prepared an overly simple script that traps SIGINT, asks the user to
press [Enter] and then goes on with its own business
(simple-trap-sigint.sh, that should be found attached to this message).
I believe that trapping SIGINT and using this signal for something
other than an immediate exit is a perfectly legitimate use of SIGINT.
An already cited document [1] confirms this.
[1] https://www.cons.org/cracauer/sigint.html
When this script is called by a trivial script executed by bash
(calling-script.sh, also attached), everything works as expected, since
GNU bash implements the WCE approach (explained in [1]):
$ ./calling-script.sh
Start
Hello!
Output 1
Output 2
Output 3
^CPress [Enter] to continue
Output 4
Output 5
Output 6
Output 7
Output 8
Output 9
Output 10
Bye!
End
Of course, the last part of the output (from "Output 4" onwards) is
shown after hitting [Enter], as requested.
On the other hand, when the script is executed by APT as a hook, things
go wrong somehow:
# cat /etc/apt/apt.conf.d/05test
DPkg::Pre-Install-Pkgs {"/root/simple-trap-sigint.sh";};
# apt install locales
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libc-l10n
The following NEW packages will be installed:
libc-l10n locales
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4198 kB of archives.
After this operation, 17.1 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Hello!
Output 1
Output 2
Output 3
Output 4
^CPress [Enter] to continueOutput 5
# Output 6
Output 7
Output 8
Output 9
Output 10
Bye!
#
After pressing [Ctrl+C], the hook (simple-trap-sigint.sh) shows the
expected "Press [Enter] to continue" message, but immediately goes
on with its output, without waiting for input from the user.
The final prompt is obtained after hitting [Enter]. But apt has
already exited, instead of waiting for the hook to exit and checking
whether the hook was killed by a SIGINT...
What's wrong? Does libapt implement the IUE approach (explained in [1])?
If this is the case, then I think that the WCE approach should be
implemented instead, at least when executing hooks, since some hooks
may use SIGINT for purposes other than an immediate exit.
I am consequently reassigning this bug report to apt/1.3~pre2 ...
Please fix this issue.
Thanks for your time.
Bye.
--
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
Attachment:
simple-trap-sigint.sh.gz
Description: application/gzip
Attachment:
calling-script.sh.gz
Description: application/gzip
Attachment:
pgpZhkuz47Uw1.pgp
Description: PGP signature