Bug 618003 - urlgrabber raises IOError exceptions without providing proper errno
urlgrabber raises IOError exceptions without providing proper errno
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: python-urlgrabber (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: James Antill
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 551932
  Show dependency treegraph
 
Reported: 2010-07-25 10:53 EDT by Bruno Wolff III
Modified: 2014-01-21 18:16 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-16 14:21:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch for the range error being improperly constructed for an IOError (2.53 KB, patch)
2010-09-03 16:04 EDT, seth vidal
no flags Details | Diff

  None (edit)
Description Bruno Wolff III 2010-07-25 10:53:26 EDT
Description of problem:
python-urlgrabber raises IOError exceptions in several places. Either using a string for errno or not providing errno at all.
For example (in byterange.py):
raise IOError('seek from end of file not supported.')
raise IOError, ('ftp error', 'no host given')
raise IOError, ('ftp error', msg), sys.exc_info()[2]
raise IOError, ('ftp error', reason), sys.exc_info()[2]
raise IOError, ('ftp error', reason), sys.exc_info()[2]

For the no errno case When this is trapped by code that is expecting there to be both an errno and strerror on the args list this can result in another exception. Also when only argument is supplied e.errno and e.strerror are null. To handle this the exception handler needs not try to reference two arguments, but rather try to use strerror and if that isn't set fallback to arg[0] and hope that is the message.

Even using 'ftp error' could potentially cause problems for things that are expecting an error code to be there, not a string.

Documentation of IOError exceptions is at:
http://docs.python.org/library/exceptions.html#exceptions.EnvironmentError

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

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Bug Zapper 2010-07-30 08:50:06 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Jasper O'neal Hartline 2010-08-13 12:55:11 EDT
Is there any more information on this?
Comment 3 seth vidal 2010-09-03 16:03:01 EDT
Bruno,
 First off - thank you for the detail. If I send a patch here - can you test and confirm that we're covered?
Comment 4 seth vidal 2010-09-03 16:04:10 EDT
Created attachment 442972 [details]
patch for the range error being improperly constructed for an IOError
Comment 5 seth vidal 2010-09-03 16:12:01 EDT
patch for this attached - let me know if it works.
Comment 6 Bruno Wolff III 2010-09-03 16:16:20 EDT
I'll test it, but maybe not real quick. I really need to get a livecd-tools update out this weekend.
Comment 7 seth vidal 2010-09-03 16:33:36 EDT
Bruno, it's not problem - I'm going run some simple tests and commit the patch, for now, since the changes are potentially no big deal.



when you get a chance, verifying it would be appreciated.

thanks
Comment 8 Mads Kiilerich 2010-09-03 19:58:42 EDT
Some comments after looking at content of python-urlgrabber-3.9.1-7.fc13.noarch and the patch:

I think it is unfortunate that urlgrabbers own exceptions inherits from IOError. They _are_ not IOErrors. It is very confusing that we can catch an IOError and see that errno is EBADF - but that it actually means invalid byte range, and that ENOMEM means socket timeout.

I think it would be better to inherit from Exception than from IOError. But OK, for now you probably also have to stay backward compatible ...

Most important right now: byterange.py also contains a
raise IOError('seek from end of file not supported.')
which probably should be something else.
Comment 9 seth vidal 2010-09-07 11:49:22 EDT
Mads,
 1. we cannot easily change it now for fear of what some of the callers are seeing
 2. the error being derived from IOError is consistent with what urllib[2] does as well - that is probably where urlgrabber learned it from.
 3. this is why a nice test case would make it more pleasant :)
Comment 10 Fedora End Of Life 2012-08-16 14:21:06 EDT
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Note You need to log in before you can comment on or make changes to this bug.