Bug 1536603

Summary: man page makes no mention of using '--' when trying to change exit on error behavior
Product: [Community] Virtualization Tools Reporter: Micah Abbott <miabbott>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-07 17:04:12 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 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.