xsf / xeps

Hosts the markup for all XMPP Protocol Extensions.
https://xmpp.org/extensions/
Other
125 stars 121 forks source link

Failure running `xmllint` on HTML builds #1316

Closed deuill closed 8 months ago

deuill commented 8 months ago

I'm seeing the following issues building HTML output for XEPs -- running on xmllint 2.12.4 (or whatever is the ArchLinux latest):

$ make --trace xep-0001.html
Makefile:110: update target 'build/xep-0001.html' due to: target does not exist
xmllint --nonet --noout --noent --loaddtd --valid "xep-0001.xml"
# Check for non-data URIs
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" xep-0001.xml 2>/dev/null && true
make: *** [Makefile:112: build/xep-0001.html] Error 1

It seems that xmllint will return a zero status code here, due to there being no img tags, but the result is inverted and the task fails completely. Running xmllint directly returns the following warning:

$ xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" xep-0001.xml
XPath set is empty

But this seems to not affect execution. Makefile hasn't changed recently, so maybe a change in xmllint?

Additionally, it seems that at least one other XEP is failing for other reasons:

$ make --trace xep-0484.html
Makefile:110: update target 'build/xep-0484.html' due to: target does not exist
xmllint --nonet --noout --noent --loaddtd --valid "xep-0484.xml"
xep-0484.xml:34: parser error : Opening and ending tag mismatch: remark line 30 and revision
    </revision>
               ^
xep-0484.xml:41: parser error : Opening and ending tag mismatch: revision line 26 and header
</header>
         ^
xep-0484.xml:242: parser error : Opening and ending tag mismatch: header line 9 and xep
</xep>
      ^
make: *** [Makefile:110: build/xep-0484.html] Error 1

Not sure if CI is set up to catch this sort of thing.

Flowdalic commented 8 months ago

The

! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true

line was added by Sam in ff0ef6d21247387eb4a3a431047338f2ee44547f referenzing #212.

This line fails now. I am not sure which entity changed here the behavior, could be xmllint von libxml2 or GNU Make. The whole construct raises two or three questions.

What I found so far is that xmllint's man page says: In case of an empty node set the "XPath set is empty" result will be shown and an error exit code will be returned.

However:

$ xmllint --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" xep-0033.xml
XPath set is empty
$ echo $?
0

I have reported this upstream as https://gitlab.gnome.org/GNOME/libxml2/-/issues/673

Flowdalic commented 8 months ago

FTR, it was xmllint that broke API starting with libxml 2.11.