After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 554765 - xmllint should validate quietly if no error
xmllint should validate quietly if no error
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: xmllint
2.6.27
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-02 20:37 UTC by Ben Liblit
Modified: 2021-02-20 16:21 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26



Description Ben Liblit 2008-10-02 20:37:03 UTC
When "xmllint --schema ..." is used to validate against a W3C XML Schema, successful validation results in a single line of output: "foo.xml validates".

There are many automated-build situations where we prefer to run all tools silently unless there is a specific problem requiring attention.  Thus, it would be preferable here for xmllint to be quiet about the validation success and simply exit with status 0.

If this is considered undesirable in the general or default case, perhaps a "--quiet" flag could be added?  I'd expect failed-validation error messages to still be printed under "--quiet", but if no errors arise, then no output should be produced.
Comment 1 Daniel Veillard 2008-10-06 09:33:29 UTC
that sounds a bit futile. If the "validates" error message disturbs you
redirect it to /dev/null . The exit status should contain 0 id parsing
and validation suceeded, if not it's a bug,

Daniel
Comment 2 Ben Liblit 2008-10-06 17:40:22 UTC
The "validates" message goes to stderr, same as any true error messages.  One cannot trivially redirect the former to /dev/null without losing the later as well.  So either I've got to filter stderr through something like "egrep -v ' validates$'", or I've got to run xmllint twice: once to check the exit status and a second time to get error messages if the exit status suggests there would have been some.  Bleh.
Comment 3 Daniel Veillard 2008-10-07 13:49:41 UTC
Bahh send a patch to the list if you really care, should be trivial, right ?

Daniel
Comment 4 Ben Liblit 2008-10-07 18:16:15 UTC
Do you have a strong preference for removing the message entirely versus removing it only if a "--quiet" flag is given?  If you have no preference, I'll favor simplicity and do the former.
Comment 5 Daniel Veillard 2008-10-08 10:35:15 UTC
changing the default behaviour is IMHO not an option, but others
on the list may have a different opinion...

Daniel
Comment 6 Vincent Lefevre 2013-10-22 11:55:23 UTC
I agree that a --quiet option would be useful. Asynchronously filtering the "... validates" message only *and* retrieving the exit status is tricky, and AFAIK not portable.

BTW, checking the exit status only to detect errors is not sufficient, so that one can be interested in messages too. See bug 710636.
Comment 7 Nick Wellnhofer 2021-02-20 16:21:34 UTC
A --quiet option was added here: https://gitlab.gnome.org/GNOME/libxml2/-/commit/02bee4c41444fa5c50e3b9ad5f851656b6d0b086