Skip to content

line numbers not working as expected #1493

@flavorjones

Description

@flavorjones

(reported on nokogiri-talk by @justinthec)

I haven't had time to look into this, but wanted to capture it so that it wouldn't get forgotten.


Hello,

Preface/libxml2

I've come across a bug that popped up once before in libxml2 back in 2008 where XML_TEXT_NODEs would always return 0 as their line number.

Link: https://mail.gnome.org/archives/xml/2008-July/msg00017.html

It was however patched that day and should have been fixed.

Commit: https://git.gnome.org/browse/libxml2/commit/?id=45efd0878aa56efa4291eec2ecdcff66d2f52fc3

Those three lines that he added still exist in the most current version of libxml2 now just under a conditional check for a (ctxt->linenumbers) flag.

Current Day libxml2: https://git.gnome.org/browse/libxml2/tree/SAX2.c?id=4472c3a5a5b516aaf59b89be602fbce52756c3e9#n1905

Nokogiri

This bug is currently present in Nokogiri 1.6.8.

I've been looking through the source in an attempt to find a fix and I'd appreciate some guidance:

Possibly relevant files:

static VALUE line(VALUE self)

static VALUE line(VALUE self)

Any ideas?

Thanks in advance,

Justin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions