From nobody@FreeBSD.org  Wed Aug 15 07:10:18 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id A18AA37B406
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 15 Aug 2001 07:10:17 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f7FEAHO25210;
	Wed, 15 Aug 2001 07:10:17 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200108151410.f7FEAHO25210@freefall.freebsd.org>
Date: Wed, 15 Aug 2001 07:10:17 -0700 (PDT)
From: Joseph Mallett <jmallett@xMach.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: su usage info shows incorrect info
X-Send-Pr-Version: www-1.0

>Number:         29730
>Category:       bin
>Synopsis:       su usage info shows incorrect info
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 15 07:20:00 PDT 2001
>Closed-Date:    Fri Aug 17 08:44:41 PDT 2001
>Last-Modified:  Fri Aug 17 08:46:45 PDT 2001
>Originator:     Joseph Mallett
>Release:        4.3-STABLE
>Organization:
xMach
>Environment:
>Description:
Someone decided it would be easy to just insert the string used by getopt() in the usage fprintf, but this is bad, because as the c flag requires an argument, it has a colon after it, and the usage output might lead a reader to believe 'su -:' did something.
>How-To-Repeat:
Type su -c without any argument.
>Fix:
--- su.orig     Tue Jun 19 00:26:30 2001
+++ su.c        Wed Aug 15 14:04:29 2001
@@ -413,7 +413,7 @@
 static void
 usage()
 {
-       (void)fprintf(stderr, "usage: su [%s] [login [args]]\n", ARGSTR);
+       (void)fprintf(stderr, "usage: su [-flm] [-c class] [login [args]]\n");
        exit(1);
 }
>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.org>
To: Joseph Mallett <jmallett@xMach.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/29730: su usage info shows incorrect info
Date: Wed, 15 Aug 2001 18:39:54 +0300

 On Wed, Aug 15, 2001 at 07:10:17AM -0700, Joseph Mallett wrote:
 [...]
 > >Fix:
 > --- su.orig     Tue Jun 19 00:26:30 2001
 > +++ su.c        Wed Aug 15 14:04:29 2001
 > @@ -413,7 +413,7 @@
 >  static void
 >  usage()
 >  {
 > -       (void)fprintf(stderr, "usage: su [%s] [login [args]]\n", ARGSTR);
 > +       (void)fprintf(stderr, "usage: su [-flm] [-c class] [login [args]]\n");
 >         exit(1);
 > 
 I have committed your fix to HEAD, but for RELENG_4 the correct fix is
 not so obvious:
 
 Index: su.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/su/su.c,v
 retrieving revision 1.34.2.2
 diff -u -p -r1.34.2.2 su.c
 --- su.c	2001/06/19 00:26:30	1.34.2.2
 +++ su.c	2001/08/15 15:36:56
 @@ -413,7 +413,18 @@ main(argc, argv)
  static void
  usage()
  {
 -	(void)fprintf(stderr, "usage: su [%s] [login [args]]\n", ARGSTR);
 +	(void)fprintf(stderr, "usage: su [-] %s%s[login [args]]\n",
 +#ifdef KERBEROS
 +	    "[-Kflm] ",
 +#else
 +	    "[-flm] ",
 +#endif
 +#ifdef LOGIN_CAP
 +	    "[-c class] "
 +#else
 +	    ""
 +#endif
 +	    );
  	exit(1);
  }
  
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
Responsible-Changed-From-To: freebsd-bugs->mikem 
Responsible-Changed-By: dd 
Responsible-Changed-When: Wed Aug 15 19:15:39 PDT 2001 
Responsible-Changed-Why:  
The fix seems reasonable, but I think Mark should deal with this, since 
he's made most of the commits to su(1) lately, including the one that 
broke this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29730 
Responsible-Changed-From-To: mikem->markm 
Responsible-Changed-By: dd 
Responsible-Changed-When: Wed Aug 15 19:16:28 PDT 2001 
Responsible-Changed-Why:  
oops: 

The fix seems reasonable, but I think Mark should deal with this, since 
he's made most of the commits to su(1) lately, including the one that 
broke this. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29730 
Responsible-Changed-From-To: markm->ru 
Responsible-Changed-By: dd 
Responsible-Changed-When: Wed Aug 15 19:17:16 PDT 2001 
Responsible-Changed-Why:  
Actually, Ruslan seems to have already fixed it.  I have no idea why my 
MUA decided to show the reply to the PR a page later after the original :-/. 
Sorry for the trouble, Mark. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29730 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Fri Aug 17 08:44:41 PDT 2001 
State-Changed-Why:  
Fixed in 5.0-CURRENT and 4.4-RC, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29730 
>Unformatted:
