GNOME Bugzilla – Bug 666217
xsltproc does not return an error code if xinclude encounters parse errors.
Last modified: 2012-08-16 13:24:18 UTC
Created attachment 203530 [details] Test files When running xsltproc with the --xinclude option and if the included file contains parse errors, then xsltproc exits with a success return code (0) rather than an error code. This is despite the fact that parser error messages are printed out. This can be reproduced with using the attached tarball via the following steps: ------------------ $ tar -xf xinclude-error-code-bug.tar.bz2 $ cd xinclude-error-code-bug $ xsltproc -o toc.xml --xinclude toc.xsl main.xhtml include.xml:7: parser error : Opening and ending tag mismatch: p line 4 and div </div> ^ include.xml:8: parser error : Premature end of data in tag div line 1 ^ main.xhtml:8: element include: XInclude error : could not load include.xml, and no fallback was found $ echo $? 0 $ --------- As a result the processing appears to complete successfully but the erroneous file is omitted from the output. If run from a makefile, we have no indication that the output is wrong. The problem seems to be that the return value of xmlXIncludeProcessFlags() is not checked for errors. The attached patch solves the problem sufficiently for my needs, but since I'm not familiar with the code base I think that it needs more work before it is release quality.
Created attachment 203532 [details] [review] Sample fix
Looks good, applied nearly as-is, since it's an error in the input document, error code should be 6 "error in documents" instead of 9 "internal error" thanks a lot for the patch, pushed: http://git.gnome.org/browse/libxslt/commit/?id=e669a8c7cefec93ee1bfaf59721aadc42e226d6e Daniel