Bug 1536603 - man page makes no mention of using '--' when trying to change exit on error behavior
Summary: man page makes no mention of using '--' when trying to change exit on error b...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-19 17:37 UTC by Micah Abbott
Modified: 2018-02-07 17:04 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-07 17:04:12 UTC
Embargoed:


Attachments (Terms of Use)

Description Micah Abbott 2018-01-19 17:37:44 UTC
The man page has a section titled "Exit On Error Behavior" which talks about instructing 'guestfish' to ignore errors from commands in non-interactive mode by prefixing a '-' character to the command generating the error.

In my case, I was trying to ignore an error from the 'mount' command like so:

$ guestfish add rhel-guest-image-6.9-206.x86_64.qcow2 : run : -mount /dev/sda1 / : cat /etc/redhat-release

But 'guestfish' was interpreting the '-mount' command as an argument to 'guestfish' itself.

The solution was to escape that string of commands with '--':

$ guestfish -- add rhel-guest-image-6.9-206.x86_64.qcow2 : run : -mount /dev/sda1 / : cat /etc/redhat-release


I scoured the man page[0] for mention of this usage and did not find anything suggesting this route.  (Although some Google searches lead me to believe this is a way to signify the end of command options...)

Even if this is not a 'guestfish' specific behavior, I think it would be useful to note this in the man page.


[0] http://libguestfs.org/guestfish.1.html

Comment 1 Pino Toscano 2018-02-07 17:04:12 UTC
Fixed with
https://github.com/libguestfs/libguestfs/commit/693a8175ee1fb520967d576f00df2ff28b6425e0
which is in libguestfs >= 1.37.38.


Note You need to log in before you can comment on or make changes to this bug.