Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 530066 - app-emacs/nxml-gentoo-schemas-20111129 incorrectly marking elements as invalid
Summary: app-emacs/nxml-gentoo-schemas-20111129 incorrectly marking elements as invalid
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-21 19:50 UTC by Ulrich Müller
Modified: 2015-04-28 17:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch for Makefile (Makefile.diff,349 bytes, patch)
2015-04-25 19:40 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2014-11-21 19:50:30 UTC
app-emacs/nxml-gentoo-schemas-20111129 incorrectly marks the first element in some xml files as invalid (e.g. for any metadata.xml, <pkgmetadata> is highlighted in red).

This occurs with both Emacs 23 and 24, and IIRC it used to work at least with Emacs 23 at some point. Not sure what has changed.
Comment 1 Ulrich Müller gentoo-dev 2015-04-24 22:13:11 UTC
I've investigated a little further.

The first observation is that xmllint reports the same error as rng-validate-mode in Emacs. For example, if I verify app-editors/emacs/metadata.xml:

$ trang /usr/share/emacs/etc/nxml-gentoo-schemas/metadata.rnc /tmp/metadata.rng
$ xmllint --relaxng /tmp/metadata.rng metadata.xml >/dev/null
metadata.xml:3: element pkgmetadata: Relax-NG validity error : Did not expect element pkgmetadata there
metadata.xml fails to validate

It doesn't help if I generate the rng file from the dtd file directly, i.e. xmllint still reports the same error after I did this:

$ trang /usr/portage/metadata/dtd/metadata.dtd /tmp/metadata.rng


The second observation is that I can work around the problem if I patch /usr/share/emacs/etc/nxml-gentoo-schemas/metadata.rnc as follows:

-start = catmetadata | packages
+start = catmetadata | packages | pkgmetadata
Comment 2 Ulrich Müller gentoo-dev 2015-04-25 19:40:02 UTC
Created attachment 402014 [details, diff]
Patch for Makefile

Trang documentation says: "Trang assumes that all elements that are defined but never referenced are allowed as document elements."

This fails for pkgmetadata because it is referenced from the packages element. A workaround is to suppress generation of a start element with "-i no-generate-start" and then add one manually. See attached patch for the Makefile.

I can roll a new tarball myself if you prefer. (I'd also update the distfile to be in tar.xz format then.)


(In reply to Ulrich Müller from comment #0)
> [...] IIRC it used to work at least with Emacs 23 at some point.

Seems unlikely. I guess it has never worked for pkgmetadata.
Comment 3 Ulrich Müller gentoo-dev 2015-04-28 17:59:00 UTC
Fixed in nxml-gentoo-schemas-20150428.