bin/110705: gmirror control utility does not exit with correct exit status

Tom Judge tom at tomjudge.com
Fri Mar 23 11:10:04 UTC 2007


>Number:         110705
>Category:       bin
>Synopsis:       gmirror control utility does not exit with correct exit status
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 23 11:10:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Tom Judge
>Release:        6.2 Release
>Organization:
>Environment:
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
     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.
>Description:
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
     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.
>How-To-Repeat:
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.
0
>Fix:
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.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list