Bug 750694 - xmltramp fails to parse: IndexError: list index out of range
Summary: xmltramp fails to parse: IndexError: list index out of range
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-xmltramp
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Dan Callaghan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-02 04:23 UTC by Dan Callaghan
Modified: 2013-06-18 01:31 UTC (History)
2 users (show)

Fixed In Version: python-xmltramp-2.17-12.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-18 01:29:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch for xmltramp.py (797 bytes, patch)
2011-11-02 04:36 UTC, Dan Callaghan
no flags Details | Diff

Description Dan Callaghan 2011-11-02 04:23:34 UTC
Description of problem:
xmltramp can't parse XML documents where a namespace prefix is declared on an element which has a following sibling.


Version-Release number of selected component (if applicable):
python-xmltramp-2.17-8.fc15


How reproducible:
always


Steps to Reproduce:
python -c 'import sys, xmltramp; xmltramp.parse(sys.stdin.read())' <<EOF
<a>
  <b xmlns:str="http://exslt.org/strings"/>
  <c/>
</a>
EOF

  
Actual results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 257, in parse
    return seed(StringIO(text))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 252, in seed
    parser.parse(fileobj)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib64/python2.7/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 338, in start_element_ns
    AttributesNSImpl(newattrs, qnames))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 227, in startElementNS
    for k in self.prefixes.keys(): newprefixes[k] = self.prefixes[k][-1]
IndexError: list index out of range


Expected results:
Should parse successfully.


Additional info:
Attaching patch with test.

Comment 1 Dan Callaghan 2011-11-02 04:36:04 UTC
Created attachment 531241 [details]
patch for xmltramp.py

Comment 2 Fedora End Of Life 2012-08-07 16:09:34 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. 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 '15' 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 15 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

Comment 3 Dan Callaghan 2012-08-07 22:03:26 UTC
Bug still applies in F17:

$ rpm -q python-xmltramp
python-xmltramp-2.17-9.fc17.noarch
$ python -c 'import sys, xmltramp; xmltramp.parse(sys.stdin.read())' <<EOF
> <a>
>   <b xmlns:str="http://exslt.org/strings"/>
>   <c/>
> </a>
> EOF
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 257, in parse
    return seed(StringIO(text))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 252, in seed
    parser.parse(fileobj)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 352, in start_element_ns
    AttributesNSImpl(newattrs, qnames))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 227, in startElementNS
    for k in self.prefixes.keys(): newprefixes[k] = self.prefixes[k][-1]
IndexError: list index out of range

Comment 4 Amit Saha 2013-01-08 16:39:53 UTC
Bug still applicable on F18.

$ rpm -q python-xmltramp
python-xmltramp-2.17-10.fc18.noarch

$ python -c 'import sys, xmltramp; xmltramp.parse(sys.stdin.read())'
<a>
<b xmlns:str="http://exslt.org/strings"/>               
<c/>
</a>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 257, in parse
    return seed(StringIO(text))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 252, in seed
    parser.parse(fileobj)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib64/python2.7/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 338, in start_element_ns
    AttributesNSImpl(newattrs, qnames))
  File "/usr/lib/python2.7/site-packages/xmltramp.py", line 227, in startElementNS
    for k in self.prefixes.keys(): newprefixes[k] = self.prefixes[k][-1]
IndexError: list index out of range

Comment 5 Fedora Admin XMLRPC Client 2013-06-07 05:53:45 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora Update System 2013-06-07 06:48:07 UTC
python-xmltramp-2.17-12.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/python-xmltramp-2.17-12.fc19

Comment 7 Fedora Update System 2013-06-07 06:48:48 UTC
python-xmltramp-2.17-12.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/python-xmltramp-2.17-12.fc18

Comment 8 Fedora Update System 2013-06-07 06:49:19 UTC
python-xmltramp-2.17-12.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/python-xmltramp-2.17-12.fc17

Comment 9 Fedora Update System 2013-06-07 23:52:19 UTC
Package python-xmltramp-2.17-12.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-xmltramp-2.17-12.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-10322/python-xmltramp-2.17-12.fc18
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-06-17 04:32:46 UTC
python-xmltramp-2.17-12.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2013-06-18 01:29:47 UTC
python-xmltramp-2.17-12.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2013-06-18 01:31:52 UTC
python-xmltramp-2.17-12.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


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