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 731133 - xmllint stops processing command line options after encountering "-"
xmllint stops processing command line options after encountering "-"
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: xmllint
git master
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-06-02 23:37 UTC by Dennis Filder
Modified: 2021-07-05 13:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Command line parsing: treat "-" like any other filename. (431 bytes, patch)
2014-06-02 23:37 UTC, Dennis Filder
none Details | Review

Description Dennis Filder 2014-06-02 23:37:09 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.
Comment 1 Daniel Veillard 2014-06-09 03:07:45 UTC
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
Comment 2 Nick Wellnhofer 2017-06-17 10:38:55 UTC
> xmllint - --version will allow to parse a file named '-version'

This is not true. '-' means reading from stdin. Also see bug 640065.
Comment 3 GNOME Infrastructure Team 2021-07-05 13:25:37 UTC
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.