Horrible response to keyboardInterrupt

CAI Qian <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
Hi,

The Bugzilla did not allow me to register, so I report a problem here.
Yum had bad response to CTRL-C in various of situations. For example,
in case of a DNS lookup failure,

- run "yum -y install openoffice.org-langpack-zh_CN", and cancel it
when starting to download RPM packages.

Downloading Packages:
(1/10): openoffice.org-draw-cor (0%) 28% [======                ]  13
kB/s | 304 kB     00:59 ETA (1/10):
openoffice.org-draw-core-3.0.0-4.2.fc10.x86_64.rpm                 |
336 kB     00:02     

 Current download cancelled, interrupt (ctrl-c) again within two
seconds to exit.

^C

Exiting on user cancel

- change all nameservers in /etc/resolv.conf to incorrect IPs.
- run "yum -y install openoffice.org-langpack-zh_CN" again, and try to
cancel it.

Then, the session could not be cancelled,

Downloading Packages:
^C^C^C^C^C^C^C^C^C^C^C^C^C^C
 Current download cancelled, interrupt (ctrl-c) again within two
seconds to exit.
^C^C^C^C^C^C^C^C^C^C
http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/development/x86_64/os/Packages/openoffice.org-draw-core-3.0.0-4.2.fc10.x86_64.rpm:
[Errno 4] IOError: <urlopen error (-2, 'Name or service not known')>
Trying other mirror.
http://fedora.secsup.org/linux/development/x86_64/os/Packages/openoffice.org-draw-core-3.0.0-4.2.fc10.x86_64.rpm:
[Errno 4] IOError: <urlopen error (-2, 'Name or service not known')>
Trying other mirror.
...

No matter how many and quickly CTRL-C typed, it kept trying all
mirrors.

If I added the following dirty workaround patch, I could finally exit
it, although it was not responded immediately, and I had to hit CTRL-C
several times.

--- urlgrabber-3.0.0/urlgrabber/grabber.py~	2008-09-09
18:06:50.000000000 +0800
+++ urlgrabber-3.0.0/urlgrabber/grabber.py	2008-09-09
22:06:15.000000000 +0800
@@ -1218,6 +1218,8 @@
         except HTTPException, e:
             raise URLGrabError(7, _('HTTP Exception (%s): %s') % \
                             (e.__class__.__name__, e))
+        except KeyboardInterrupt:
+            exit (0)
         else:
             return (fo, hdr)

Maybe we should rewrite it in C to get better performance?

Software version,
yum-3.2.19
urlgrabber-3.0.0

Cai Qian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.