Bug 810953

Summary: Don't raise KeyboardInterrupt
Product: [Fedora] Fedora Reporter: Kamil Páral <kparal>
Component: python-urlgrabberAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: danielkza2, dmach, james.antill
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-18 21:29:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kamil Páral 2012-04-09 17:57:17 UTC
Description of problem:
My scripts using URLGrabber sometimes crash with KeyboardInterrupt. I can guarantee you I did not press Ctrl+C. It is possible that the script got terminated somehow, maybe, but definitely it was not a keyboard interrupt, which is a user-oriented action. I researched it originates from here:

/usr/lib/python2.7/site-packages/urlgrabber/grabber.py:
>             if errcode == 23 and code >= 200 and code < 299:
>                 err = URLGrabError(15, _('User (or something) called abort %s: %s') % (errurl, e))
>                 err.url = errurl
> 
>                 # this is probably wrong but ultimately this is what happens
>                 # we have a legit http code and a pycurl 'writer failed' code
>                 # which almost always means something aborted it from outside
>                 # since we cannot know what it is -I'm banking on it being
>                 # a ctrl-c. XXXX - if there's a way of going back two raises to 
>                 # figure out what aborted the pycurl process FIXME
>                 raise KeyboardInterrupt

Please _never_ raise KeyboardInterrupt, especially in libraries and low-level tools. That is ultimately confusing. Authors using your library usually don't guard their code against KeyboardInterrupt coming _from a library_. It is not even inherited from Exception!

The best approach is to create your own top-level exception (inherited from Exception) and then create more specific exceptions (inherited from your top-level one). Please replace places where you throw KeyboardInterrupt now with your custom exception (or even some standard one, still better).

Thank you.

Version-Release number of selected component (if applicable):
python-urlgrabber-3.9.1-10.fc15.noarch

Comment 1 Fedora End Of Life 2013-04-03 15:08:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 2 Daniel Miranda 2014-06-07 09:50:28 UTC
This bug still exists and still bytes me when I'm trying to use urlgrabber. It makes no sense to ever raise a KeyboardInterrupt ever.

Comment 3 Daniel Mach 2018-07-18 21:29:57 UTC
yum and related packages are no longer actively developed.
They are being replaced with dnf, dnf-utils, etc.

I'm closing this bug because it's most likely never going to be fixed.
If you still consider your bug report important, reopen it, please.

Comment 4 Daniel Mach 2018-07-18 21:33:00 UTC
yum and related packages are no longer actively developed.
They are being replaced with dnf, dnf-utils, etc.

I'm closing this bug because it's most likely never going to be fixed.
If you still consider your bug report important, reopen it, please.