GNOME Bugzilla – Bug 731133
xmllint stops processing command line options after encountering "-"
Last modified: 2021-07-05 13:25:37 UTC
Created attachment 277772 [details] [review] Command line parsing: treat "-" like any other filename. The output of "xmllint --auto|xmllint - --version" differs from "xmllint --auto|xmllint --version -" though it shouldn't because parsing of command line options breaks after encountering "-". Output follows. user@host:~/$ xmllint --auto|xmllint - --version <?xml version="1.0"?> <info>abc</info> user@host:~/$ xmllint --auto|xmllint --version - xmllint: using libxml version 20901 compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib <?xml version="1.0"?> <info>abc</info> The attached patch should fix the issue.
That's actually on purpose, it's a common behavior that for program taking args starting with - will drop processing of args after a single '-' to allow passing arguments which are not args but still start with - . Classic example is grep, xmllint - --version will allow to parse a file named '-version' Not a bug, it really was intended as a feature, though it seems it doesn't really do the expected, so keeping this open as something is wrong there and will neeed some investigations ... Daniel
> xmllint - --version will allow to parse a file named '-version' This is not true. '-' means reading from stdin. Also see bug 640065.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.