Bug 618003 - urlgrabber raises IOError exceptions without providing proper errno
Summary: urlgrabber raises IOError exceptions without providing proper errno
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: python-urlgrabber
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: James Antill
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 551932
TreeView+ depends on / blocked
 
Reported: 2010-07-25 14:53 UTC by Bruno Wolff III
Modified: 2014-01-21 23:16 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-08-16 18:21:03 UTC
Type: ---
Embargoed:


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

Description Bruno Wolff III 2010-07-25 14:53:26 UTC
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 12:50:06 UTC
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 16:55:11 UTC
Is there any more information on this?

Comment 3 seth vidal 2010-09-03 20:03:01 UTC
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 20:04:10 UTC
Created attachment 442972 [details]
patch for the range error being improperly constructed for an IOError

Comment 5 seth vidal 2010-09-03 20:12:01 UTC
patch for this attached - let me know if it works.

Comment 6 Bruno Wolff III 2010-09-03 20:16:20 UTC
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 20:33:36 UTC
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 23:58:42 UTC
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 15:49:22 UTC
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 18:21:06 UTC
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.