-
-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:first-child broken with libxml 2.9.0 #829
Comments
verified by downgrading:
|
How did you downgraded libxml? |
@lucasgertel using the package manager of my Linux distribution (emerge on Gentoo) |
+1 for me also nth-child(n) seems to be broken with libxml 2.9.0 |
Please note that Team Nokogiri hasn't made any effort yet to support libxml 2.9.0. It's next on my list after we release 1.5.7. |
The problem seems odd. comparing on another machine running 2.8.0 works normally. In 2.9.0 it appears that a blank node is found for each odd :nth-child. You can see the debugger output to prove this issue https://gist.github.com/Themitchell/5135296 So 1st, 3rd and 5th nodes work which should be 1st, 2nd and 3rd (and indeed are correctly returned as 1st, 2nd, 3rd on a 2.8.0 system) Hope that gives a little more context on the issue. |
This appears to be a bug in libxml 2.9.0. I will be submitting a bug report to Daniel Veillard today. In the meantime, downgrade to 2.8.0 if you can. |
To be specific, it appears that the xpath function
We can run the following script:
and for 2.8.0 and 2.9.0 get the following (different) outputs:
and
|
Bug reported to libxml2 here: https://bugzilla.gnome.org/show_bug.cgi?id=695699 |
The bug reported on libxml2 is resolved as NOTABUG. |
OK, so the libxml2 team is saying that the XPath queries in 2.8.x and earlier releases of libxml2 are buggy, and 2.9.0 is doing the right thing: So I'm going to (gag) put in a libxml2-version-specific workaround (gag). |
Hmm. I'm pushing back against the libxml2 list on this one. Libxml 2.9.0 is the only implementation I can find with behavior, which makes it suspect. Hang tight and I'll let you know how it progresses. |
Please note that Daniel has confirmed that this behavior appears to be a bug in libxml 2.9.0. |
Possibly relevant to followers of this issue: Nokogiri 1.6.0.rc1 (just released) includes libxml 2.8.0, which is compiled and installed at gem-install time. So, if you've got libxml 2.9.0 installed on your system and can't work around it, please try Nokogiri 1.6.0.rc1 and let me know how you get on. |
@flavorjones is that intended as a temporary workaround? I hope so to avoid bundled libraries down the road. |
@flavorjones Nokogiri 1.6.0.rc1 works fine for me with libxml 2.9.0 - thanks for the hint |
@betelgeuse Bundling libxml is probably the future. Read the release notes for info on how to use system libraries. |
@flavorjones ok that at least makes sure Linux distributions can continue using system libraries. Are you open to having that info also in the README? |
To all Mac users wondering how to solve this issue. It turns out I've had libxml 2.9.0 installed through the homebrew. You can check directory |
I can also confirm that using 1.6.0.rc1 fixed the problem for me. Here is my test case: https://gist.github.com/mkwiatkowski/5612006 |
Hi! Cedric |
Anyone having this problem / nth-child problem on Mavericks, I found that 1.6.0 apparently didn't solve the problem, but it turned out (with help from http://blog.planetargon.com/entries/2013/10/24/os-x-mavericks-failing-specs-and-libxml and #742) that the solution was to have Nokogiri explicitly listed very early in my Gemfile before other dependencies load system libxml2 (probably pg was the problem). BTW tried using brew to install libxml2 2.8.0 & corresponding libxslt -- worked in a limited fashion but gave other problems elsewhere (too many apple-supplied libraries depends on libxml2 2.9+ ) - even changing DYLD_LIBRARY_PATH just for test runs was a problem (save_and_open_page would fail for example). |
moving the nokogiri entry in my Gemfile above all other gems solved the problem for me as well |
I had the same problem using nokogiri 1.5.10 (to be used in ree) I fixed it by manually linked to libxml2 v2.8.0 nokogiri on install
libxml2 and libxslt installed with homebrew, libiconv was installed from source. |
Solved my problem by upgrading the Nokogiri gem to 1.6.1 |
same problem on Mavericks. currently unresolved. nokogiri -v
|
This is fixed in 1.6.4 and later, which is when we upgraded to libxml 2.9.2. |
I'm deciding to drop support for earlier versions because: - 2.7.7 nanohttp.c doesn't compile on modern systems - 2.8.0 doesn't have PARSE_BIG_LINES, GNOME/libxml2@968a03a2 introduced it in 2.9.0 - 2.9.0 and 2.9.1 have the xpath optimization bug that ruined our CSS queries in :first-child broken with libxml 2.9.0 #829, GNOME/libxml2@b4bcba23 fixed it in 2.9.2 Also, bump the min recommended version to v2.12.0 because Nick has fixed a lot of long-standing issues upstream. ♥ ♥ ♥ Followup to #3232 Closes #3287
**What problem is this PR intended to solve?** I'm deciding to drop support for earlier versions because: - 2.7.7 nanohttp.c doesn't compile on modern systems - 2.8.0 doesn't have PARSE_BIG_LINES, GNOME/libxml2@968a03a2 introduced it in 2.9.0 - 2.9.0 and 2.9.1 have the xpath optimization bug that ruined our CSS queries in :first-child broken with libxml 2.9.0 #829, GNOME/libxml2@b4bcba23 fixed it in 2.9.2 Also, bump the min recommended version to v2.12.0 because Nick has fixed a lot of long-standing issues upstream. ♥ ♥ ♥ Followup to #3232 Closes #3287 **Have you included adequate test coverage?** Existing coverage is sufficient. **Does this change affect the behavior of either the C or the Java implementations?** No.
A test suite for my application started failing and I think this is due to upgrading libxml to 2.9.0. It seems nokogiri is not able to do first-child properly with it atm:
The text was updated successfully, but these errors were encountered: