Bug 709701

Summary: Bad exception on entering invalid netaddr.IPNetwork
Product: [Fedora] Fedora Reporter: Jakub Hrozek <jhrozek>
Component: python-netaddrAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jeckersb, jhrozek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-netaddr-0.7.5-3.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 710373 (view as bug list) Environment:
Last Closed: 2011-06-07 04:42:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 710373    

Description Jakub Hrozek 2011-06-01 12:42:06 UTC
Description of problem:
If an IPNetwork object is instantiated with bad data, the python-netaddr code tries to access an unbound local variable. It should raise an appropriate exception instead.

This means that a user of python-netaddr must check for all exceptions instead of just expecting netaddr.core.AddrFormatError.

Version-Release number of selected component (if applicable):
python-netaddr-0.7.5-2

How reproducible:
always

Steps to Reproduce:
1. python -c "import netaddr; netaddr.IPNetwork('3333/32')"
  
Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 919, in __init__
    implicit_prefix, flags)
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 782, in parse_ip_network
    value = ip._value
UnboundLocalError: local variable 'ip' referenced before assignment


Expected results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/netaddr/ip/__init__.py", line 926, in __init__
    raise AddrFormatError('invalid IPNetwork %s' % addr)
netaddr.core.AddrFormatError: invalid IPNetwork 3333/32


Additional info:
Upstream was tracking this as issue #2 and #5 in github

Comment 1 Fedora Update System 2011-06-02 06:08:36 UTC
python-netaddr-0.7.5-3.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/python-netaddr-0.7.5-3.fc15

Comment 2 Fedora Update System 2011-06-03 05:28:04 UTC
Package python-netaddr-0.7.5-3.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-netaddr-0.7.5-3.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/python-netaddr-0.7.5-3.fc15
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2011-06-07 04:41:59 UTC
python-netaddr-0.7.5-3.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.