Same Xpath returns different values in Centos, Ubuntu

Bug #1631866 reported by Lorenzo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Invalid
Undecided
Unassigned

Bug Description

Note: I've opened the same request here: http://stackoverflow.com/questions/39899632/same-xpath-returns-different-values-on-centos-ubuntu

Given this simple XML:

<root>
    <outer>
        <inner>
            <el/>
        </inner>
        <inner>
            <el/>
        </inner>
    </outer>
</root>

This code:

from lxml import etree
r = etree.parse('foo.xml')
print 'One: ', r.xpath('.//el[2]')
print 'Two: ', r.xpath('(.//el)[2]')

Returns different output on different versions of Linux:

On Centos (python 2.7.5):

One: [<Element el at 0x25fdcf8>]
Two: [<Element el at 0x25fdcf8>]

Library versions:

Python : sys.version_info(major=2, minor=7, micro=5, releaselevel='final', serial=0)
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)

On RedHat Enterprise 6.6 (python 2.7.11)

One: []
Two: [<Element el at 0x7fa27198cd40>]

Library versions:

Python : sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0)
lxml.etree : (3, 6, 0, 0)
libxml used : (2, 7, 6)
libxml compiled : (2, 7, 6)
libxslt used : (1, 1, 26)
libxslt compiled : (1, 1, 26)

On Debian and Ubuntu (python 2.7.9 and 2.7.12):

One: []
Two: [<Element el at 0x7f94ed6cf200>]

Debian library versions:

Python : sys.version_info(major=2, minor=7, micro=9, releaselevel='final', serial=0)
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)

Ubuntu library versions:

Python : sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0)
lxml.etree : (3, 6, 4, 0)
libxml used : (2, 9, 3)
libxml compiled : (2, 9, 3)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)

Revision history for this message
Lorenzo (lorenzo-grespan) wrote :

A helpful comment from SO (http://stackoverflow.com/questions/39899632/same-xpath-returns-different-values-on-centos-ubuntu/39956501#39956501) suggests the issue is with Centos' libxml (2.9.1) which does not fix https://bugzilla.redhat.com/show_bug.cgi?id=1357971 and https://bugzilla.gnome.org/show_bug.cgi?id=695699.

I think this bug can be closed as it's related to libxml and not lxml.

Revision history for this message
Lorenzo (lorenzo-grespan) wrote :

Problem is with libxml, not lxml.

Changed in lxml:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.