From nobody@FreeBSD.org  Fri Mar 23 10:44:13 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 9E37E16A401
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 10:44:13 +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 8FB4813C448
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 10:44:13 +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 l2NAiDo4017329
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 Mar 2007 10:44:13 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l2NAdBNq015818;
	Fri, 23 Mar 2007 10:39:11 GMT
	(envelope-from nobody)
Message-Id: <200703231039.l2NAdBNq015818@www.freebsd.org>
Date: Fri, 23 Mar 2007 10:39:11 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:         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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 23 10:50:02 GMT 2007
>Closed-Date:    Fri Mar 23 11:12:30 GMT 2007
>Last-Modified:  Fri Mar 23 11:12:30 GMT 2007
>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:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Fri Mar 23 11:12:27 UTC 2007 
State-Changed-Why:  
duplicate of 110705 

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