Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2007 10:39:11 GMT
From:      Tom Judge<tom@tomjudge.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/110704: gmirror control utility does not exit with correct exit status
Message-ID:  <200703231039.l2NAdBNq015818@www.freebsd.org>
Resent-Message-ID: <200703231050.l2NAo3qo023054@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 23 10:50:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Tom Judge
>Release:        6.2 Release
>Organization:
>Environment:
FreeBSD bunsen.mintel.co.uk 6.2-RELEASE FreeBSD 6.2-RELEASE #2: Tue Mar 20 10:32:46 GMT 2007     root@bob.mintel.co.uk:/usr/obj/usr/src/sys/BUNSEN_BEAKER  i386
>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703231039.l2NAdBNq015818>