misc/110704: gmirror control utility does not exit with correct exit status

Tom Judge tom at tomjudge.com
Fri Mar 23 10:50:03 UTC 2007

>Number:         110704
>Category:       misc
>Synopsis:       gmirror control utility does not exit with correct exit status
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 23 10:50:02 GMT 2007
>Originator:     Tom Judge
>Release:        6.2 Release
FreeBSD bunsen.mintel.co.uk 6.2-RELEASE FreeBSD 6.2-RELEASE #2: Tue Mar 20 10:32:46 GMT 2007     root at bob.mintel.co.uk:/usr/obj/usr/src/sys/BUNSEN_BEAKER  i386
When requesting the gmirror status of a non existant device the gmirror utility exits with a 0 exit status which according to the man page indicates that the command completed successfuly.

>From man 8 gmirror:

     Exit status is 0 on success, and 1 if the command fails.

I would have thought the command has failed if the device of whom the status is being requested does not exist.
Assuming gm0 is not an active gmirror device, and is not listed in the output of "gmirror status"

gmirror status gm0; echo $?
No such geom: gm0.
It would seem that the gctl_req structure has members that allow for storing of error states perhapse these could be used in the cases where error conditions are found (std_list, std_status etc...).  Or exit(EXIT_FAILURE) could be called.

>From sbin/geom/core/geom.c  I seems that neither "Class not found" or "No such geom" cause exit(EXIT_FAILURE), where ase "Cannon get GEOM tree" does.

More information about the freebsd-bugs mailing list