From john@ns1.jnielsen.net  Tue Nov 21 18:30:50 2006
Return-Path: <john@ns1.jnielsen.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A33F016A416
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 21 Nov 2006 18:30:50 +0000 (UTC)
	(envelope-from john@ns1.jnielsen.net)
Received: from ns1.jnielsen.net (ns1.jnielsen.net [69.55.238.237])
	by mx1.FreeBSD.org (Postfix) with ESMTP id CCA2543D76
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 21 Nov 2006 18:30:23 +0000 (GMT)
	(envelope-from john@ns1.jnielsen.net)
Received: from ns1.jnielsen.net (jn@ns1 [69.55.238.237])
	by ns1.jnielsen.net (8.12.9p2/8.12.9) with ESMTP id kALIUdVu022984;
	Tue, 21 Nov 2006 10:30:39 -0800 (PST)
	(envelope-from john@ns1.jnielsen.net)
Received: (from john@localhost)
	by ns1.jnielsen.net (8.12.9p2/8.12.9/Submit) id kALIUdeh022982;
	Tue, 21 Nov 2006 10:30:39 -0800 (PST)
	(envelope-from john)
Message-Id: <200611211830.kALIUdeh022982@ns1.jnielsen.net>
Date: Tue, 21 Nov 2006 10:30:39 -0800 (PST)
From: John Nielsen <john@jnielsen.net>
Reply-To: John Nielsen <john@jnielsen.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: John Nielsen <john@jnielsen.net>
Subject: Misleading error message from e.g. "df -l -t ufs"
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         105721
>Category:       bin
>Synopsis:       Misleading error message from e.g. "df -l -t ufs"
>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:   Tue Nov 21 18:40:14 GMT 2006
>Closed-Date:    Sat Mar 17 02:23:03 GMT 2007
>Last-Modified:  Sat Mar 17 02:23:03 GMT 2007
>Originator:     John Nielsen
>Release:        FreeBSD 4.9-RELEASE-p13-jc2 i386
>Organization:
>Environment:
System: FreeBSD ns1.jnielsen.net 4.9-RELEASE-p13-jc2 FreeBSD 4.9-RELEASE-p13-jc2 #9: Tue Jun 7 00:30:36 PDT 2005 user@jail16.johncompanies.com:/usr/obj/usr/src/sys/jail16 i386
Also happens on 6.2-STABLE.

	
>Description:
	"df -t ufs -l" gives an informative error message; namely that
	-l and -t are mutually exclusive. However, "df -l -t ufs" produces
	"only one -t option may be specified", when in fact the error
	should be the same as in the first case.
	
>How-To-Repeat:
	df -l -t ufs
	df -t ufs -l
>Fix:

	


>Release-Note:
>Audit-Trail:

From: Fabian Ruch <Fabian.Ruch@gmx.de>
To: bug-followup@FreeBSD.org,  john@jnielsen.net
Cc:  
Subject: Re: bin/105721: Misleading error message from e.g. "df -l -t ufs"
Date: Tue, 28 Nov 2006 16:46:59 +0100

 A short time ago I contacted the submitter John Nielsen. Now he 
 suggested that I send a similar mail as followup. This is my first look 
 at a problem report as you probably can see when looking at my "fix" 
 (works out, but maybe doesn't please you). Please give me feedback and 
 tell me what to do better next time.
 
 When there are filesystems not mounted locally df should report an error 
 if the '-l' and '-t' arguments are specified at the same time. But the 
 correct error ("-l and -t are mutually exclusive.") is only mentioned if 
 you specify the '-t' argument before the '-l' one. Otherwise df thinks 
 '-t' is specified twice ("only one -t option may be specified").
 Another problem can be discussed. Shall df break if the '-l' argument is 
 specified but it doesn't effect anything? df behaves in the same 
 situation in different ways depending on the order the arguments appear. 
 For example if '-l' specified first df ignores this and goes on. In 
 contrast df breaks if '-l' is specified after '-t' ("-l and -t are 
 mutually exclusive."). This should be displayed in both cases or in none 
 of both.
 
 Now there is more than one way to solve the problem. We could declare 
 another flag variable (to tell df that '-l' is specified). Another way 
 is to check whether '-l' effects df's work.
 The added Fix does declare another flag variable (no great work, I 
 know). df will break at to points. The first breakpoint is when the '-t' 
 argument is specified twice and '-l' isn't specified at this time. The 
 second breakpoint is when '-t' and '-l' are specified at the same time.
 
 Regards,
     Fabian
 
 --
 
   --- df.c        Mon Jan 10 09:39:21 2005
   +++ df.c        Sun Nov 26 17:59:04 2006
   @@ -93,7 +93,7 @@
           return (a > b ? a : b);
    }
 
   -static int     aflag = 0, cflag, hflag, iflag, nflag;
   +static int     aflag = 0, lflag = 0, cflag, hflag, iflag, nflag;
    static struct  ufs_args mdev;
 
    int
   @@ -147,8 +147,9 @@
                           hflag = 0;
                           break;
                   case 'l':
   -                       if (vfslist != NULL)
   +                       if (!lflag && vfslist != NULL)
                                   errx(1, "-l and -t are mutually 
 exclusive.");
   +                       lflag = 1;
                           vfslist = makevfslist(makenetvfslist());
                           break;
                   case 'm':
   @@ -159,7 +160,9 @@
                           nflag = 1;
                           break;
                   case 't':
   -                       if (vfslist != NULL)
   +                       if (lflag)
   +                               errx(1, "-l and -t are mutually 
 exclusive.");
   +                       else if (vfslist != NULL)
                                   errx(1, "only one -t option may be 
 specified");
                           fstype = optarg;
                           vfslist = makevfslist(optarg);
State-Changed-From-To: open->patched 
State-Changed-By: will 
State-Changed-When: Thu Mar 8 06:10:50 UTC 2007 
State-Changed-Why:  
Fixed in -CURRENT, will MFC to 6-STABLE in 1 week. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/105721: commit references a PR
Date: Thu,  8 Mar 2007 06:10:23 +0000 (UTC)

 will        2007-03-08 06:10:17 UTC
 
   FreeBSD src repository
 
   Modified files:
     bin/df               df.c 
   Log:
   Fix a bug where the mutual exclusivity of the -l and -t options is not
   recognized properly if -l is specified first.
   
   PR:                     bin/105721
   MFC after:      1 week
   
   Revision  Changes    Path
   1.67      +4 -1      src/bin/df/df.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"
 
State-Changed-From-To: patched->closed 
State-Changed-By: will 
State-Changed-When: Sat Mar 17 02:22:16 UTC 2007 
State-Changed-Why:  
Fixed in 6-STABLE: df.c:r1.64.2.2. 

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