Package: apt-listchanges
Version: 2.79
Severity: normal
Tags: patch
Hi,
apt-listchanges cannot interrupted by pressing Ctrl-C
while 'Reading changelogs...' is printed.
How to reproduce:
1) Run `aptitude safe-upgrade` and press Ctrl-C while 'Reading changelogs...'
is printed.
2) Or, run 'apt-listchanges /var/cache/apt/archives/*'
and press Ctrl-C while 'Reading changelogs...' is printed.
Note: Problem is occurred when processing newer .deb files.
Executing 'aptitude clean; aptitude -d safe-upgrade' can be used to
fill /var/cache/apt/archives/ with newer .deb files.
After some review of source code, apt-listchanges seems ignore
the return value of os.system() in
apt-listchanges-2.79/apt-listchanges/DebianFiles.py:
# tar exits unsuccessfully if _any_ of the files we wanted
# were not available, so we can't do much with its status
os.system(extract_command)
Above comment text is right, but the return value of os.system() can be also
used to inspect whether the child process is exited due to signal or not.
Because of system(3) ignores SIGINT signal while the child process is running,
the parent process (apt-listchanges) cannot receives SIGINT signal.
So that, when Ctrl-C is pressed and SIGINT signal was sent,
only the child process can receives SIGINT signal.
Inspecting the return value of os.system() allows the parent process to
determine whether SIGINT was sent.
I think that if the child process exited due to SIGINT, the parent process
should work as they also got SIGINT signal, 'exit()' in most case.
I suggest to apply following patch:
diff -ur apt-listchanges-2.79.orig/apt-listchanges/DebianFiles.py
apt-listchanges-2.79/apt-listchanges/DebianFiles.py
--- apt-listchanges-2.79.orig/apt-listchanges/DebianFiles.py 2007-12-13
16:54:32.000000000 +0900
+++ apt-listchanges-2.79/apt-listchanges/DebianFiles.py 2007-12-14
13:15:42.000000000 +0900
@@ -30,6 +30,7 @@
import errno
import glob
import shutil
+import signal
import apt_pkg
from ALChacks import *
@@ -147,7 +148,10 @@
# tar exits unsuccessfully if _any_ of the files we wanted
# were not available, so we can't do much with its status
- os.system(extract_command)
+ status = os.system(extract_command)
+
+ if os.WIFSIGNALED(status) and os.WTERMSIG(status) == signal.SIGINT:
+ raise KeyboardInterrupt
return tempdir
Note: Since python raises KeyboardInterrupt exception when Ctrl-C is pressed,
I have made it to raises KeyboardInterrupt exception, too.
With this change, apt-listchanges correctly exited when Ctrl-C is
pressed while the child process is running.
While testing above patch by
execute 'apt-listchanges /var/cache/apt/archives/*' and press Ctrl-C,
execute 'apt-listchanges /var/cache/apt/archives/*' and press Ctrl-C,
execute 'apt-listchanges /var/cache/apt/archives/*' and press Ctrl-C..., again
and again,
I found that many temporary directory (/tmp/apt-listchangesXXXXX) is remained
in /tmp.
I think it would be nice if temporary directory is surely removed.
But unfortunately, I can't do anything for that because I have not enough
knowledge for python programing...
Regards,
Morita Sho
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-3-k7 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages apt-listchanges depends on:
ii apt 0.7.9 Advanced front-end for dpkg
ii debconf [debconf-2.0] 1.5.17 Debian configuration management sy
ii debianutils 2.28.2 Miscellaneous utilities specific t
ii python 2.4.4-6 An interactive high-level object-o
ii python-apt 0.7.4 Python interface to libapt-pkg
ii python-support 0.7.5 automated rebuilding support for p
ii ucf 3.004 Update Configuration File: preserv
Versions of packages apt-listchanges recommends:
ii exim4 4.68-2 meta-package to ease Exim MTA (v4)
ii exim4-daemon-light [mail-tran 4.68-2 lightweight Exim MTA (v4) daemon
ii python-glade2 2.12.0-2 GTK+ bindings: Glade support
ii python-gtk2 2.12.0-2 Python bindings for the GTK+ widge
-- debconf information:
* apt-listchanges/confirm: true
* apt-listchanges/which: both
* apt-listchanges/frontend: browser
* apt-listchanges/email-address:
* apt-listchanges/save-seen: true
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]