Bug 1018369
Summary: | virsh documentation error: option --domain already seen | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Chris Evich <cevich> |
Component: | libvirt | Assignee: | Eric Blake <eblake> |
Status: | CLOSED WONTFIX | QA Contact: | lijuan men <lmen> |
Severity: | low | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.0 | CC: | dyuan, eblake, mzhan, rbalakri, xuzhang |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-12-21 20:41:30 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Chris Evich
2013-10-11 19:12:11 UTC
Not (necessarily) a bug. The parser is currently coded to non-lookahead parsing, so: attach-device /path/to.xml ... is parsed as: attach-device --domain /path/to.xml ... regardless of the contents of '...'. It _might_ be possible to change that to do a full-scan parse, where all explicit options are removed from the set of options that must then be mapped to remaining positional arguments. But doing that might break existing clients that are used to the current parse rules. And it is also more complex: attach-device --file --domain --config foo should parse the same as: attach-device --domain=foo --file=--domain --config but that means you can't just look for arguments with leading '--', you also have to know the context of whether the previous argument was an option that requires data vs. a boolean option. Finally, you can ALWAYS be more explicit and provide: attach-device --file=/path/to.xml --domain=virt-tests-vm1 --config if you want to avoid positional parsing, so it's not like the current parsing rules are actively preventing you from constructing a valid command line. As such, I'm inclined to close this as not a bug, unless I hear further good arguments why we should make a change. (In reply to Chris Evich from comment #0) > Additional info: > It works fine if --domain opt comes before /path/to.xml, so this possibly > could be fixed with fairly simple man and --help doc. update If we go the improved doc route, what wording would you suggest? (I'm a bit biased since I wrote the bulk of the current parse code, and am worried that code changes could risk unintended back-compat breakage in spite of our existing testsuite on option parsing). Yeah, not surprised that messing with the parser would be difficult. I also suspect there are many other commands with a similarly challenged help: SYNOPSIS attach-device <domain> <file> [--persistent] [--config] [--live] [--current] No info is provided about --domain/--file. However, I think maybe just a simple tweak could fix this, How about: SYNOPSIS attach-device [--domain] <domain> [--file] <file> [--persistent] [--config] [--live] [--current] Same thing for the man page: attach-device [--domain] domain [--file] FILE [[[--live] [--config] | [--current]] | [--persistent]] Another idea is to just add a blanket statement to the man page Description. It already covers a lot of the usage anyway. How about something like: "Any [OPTION] with equivalent [ARG] will be interpreted in the same order as [ARG]. For example, <domain> <file> could be --domain <domain> --file <file>, but not in any other order". As a doc fix, this should be fairly simple to get something in place to help the situation. Discussed this with Eric and decided it's not worth fixing. The behavior and documentation have been like this forever and (other) users are not complaining. |