From nobody@FreeBSD.org  Fri Mar 23 11:03:35 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 13D4416A404
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 11:03:35 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 0515F13C46C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 11:03:35 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l2NB3YI6020673
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 11:03:34 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l2NAwW1R019800;
	Fri, 23 Mar 2007 10:58:32 GMT
	(envelope-from nobody)
Message-Id: <200703231058.l2NAwW1R019800@www.freebsd.org>
Date: Fri, 23 Mar 2007 10:58:32 GMT
From: Tom Judge<tom@tomjudge.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gmirror control utility does not exit with correct exit status
X-Send-Pr-Version: www-3.0

>Number:         110705
>Category:       bin
>Synopsis:       gmirror(8) control utility does not exit with correct exit status
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-geom
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 23 11:10:03 GMT 2007
>Closed-Date:    Mon Nov 08 21:59:04 UTC 2010
>Last-Modified:  Mon Nov 08 21:59:04 UTC 2010
>Originator:     Tom Judge
>Release:        6.2 Release
>Organization:
>Environment:
>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 case "Cannot get GEOM tree"
does.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: remko 
Responsible-Changed-When: Fri Mar 23 20:50:08 UTC 2007 
Responsible-Changed-Why:  
Assign to GEOM team. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110705 
State-Changed-From-To: open->patched 
State-Changed-By: pjd 
State-Changed-When: Fri Mar 23 21:04:26 UTC 2007 
State-Changed-Why:  
Fix committed to HEAD, MFC in 2 weeks. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110705 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/110705: commit references a PR
Date: Fri, 23 Mar 2007 21:05:40 +0000 (UTC)

 pjd         2007-03-23 21:05:36 UTC
 
   FreeBSD src repository
 
   Modified files:
     sbin/geom/core       geom.c 
   Log:
   Exit status should be 1 on error.
   
   PR:             bin/110705
   Reported by:    Tom Judge
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.28      +5 -8      src/sbin/geom/core/geom.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, tom@tomjudge.com
Cc:  
Subject: Re: bin/110705: gmirror control utility does not exit with correct
 exit status
Date: Sun, 10 Feb 2008 15:28:28 +0100

 MFC to RELENG_6 missing! If done, this PR can be closed.
State-Changed-From-To: patched->closed 
State-Changed-By: rafan 
State-Changed-When: Sun Feb 10 14:58:08 UTC 2008 
State-Changed-Why:  
Patch committed in RELENG_[67] and HEAD. Thanks!. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110705 
State-Changed-From-To: closed->patched 
State-Changed-By: rafan 
State-Changed-When: Sun Feb 10 14:58:22 UTC 2008 
State-Changed-Why:  
Oops, this requires a MFC to 6 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110705 
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Mon Nov 8 21:56:49 UTC 2010 
State-Changed-Why:  
This has been fixed in 7+, and with 6-STABLE going EOL next month, the 
submitter is happy for this to be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=110705 
>Unformatted:
