From howardjp@wam.umd.edu Tue Aug 24 19:44:10 1999
Return-Path: <howardjp@wam.umd.edu>
Received: from po4.wam.umd.edu (po4.wam.umd.edu [128.8.10.166])
	by hub.freebsd.org (Postfix) with ESMTP id A140F15193
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Aug 1999 19:44:09 -0700 (PDT)
	(envelope-from howardjp@wam.umd.edu)
Received: from rac9.wam.umd.edu (root@rac9.wam.umd.edu [128.8.10.149])
	by po4.wam.umd.edu (8.9.3/8.9.3) with ESMTP id WAA08761
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Aug 1999 22:42:10 -0400 (EDT)
Received: from rac9.wam.umd.edu (sendmail@localhost [127.0.0.1])
	by rac9.wam.umd.edu (8.9.3/8.9.3) with SMTP id WAA07658
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Aug 1999 22:42:09 -0400 (EDT)
Received: (from howardjp@localhost)
	by rac9.wam.umd.edu (8.9.3/8.9.3) id WAA07653
	for FreeBSD-gnats-submit@freebsd.org; Tue, 24 Aug 1999 22:42:09 -0400 (EDT)
Message-Id: <199908250242.WAA07653@rac9.wam.umd.edu>
Date: Tue, 24 Aug 1999 22:42:09 -0400 (EDT)
From: James Howard <howardjp@wam.umd.edu>
Reply-To: howardjp@wam.umd.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Patch to env(1) for Unix 98 compatability
X-Send-Pr-Version: 3.2

>Number:         13363
>Category:       bin
>Synopsis:       Patch to env(1) for Unix 98 compatability
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 24 19:50:00 PDT 1999
>Closed-Date:    Mon Dec 20 08:38:29 PST 1999
>Last-Modified:  Mon Dec 20 08:39:29 PST 1999
>Originator:     James Howard
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
University of Maryland
>Environment:

FreeBSD byzantine 3.2-STABLE FreeBSD 3.2-STABLE #5: Sat Aug  7 23:43:54 GMT 1999     root@byzantine:/usr/src/sys/compile/BYZANTINE  i386

>Description:

Unix 98 requires that env(1) take the option -i to destroy the
inherited environment.  This would be identical to the currently
existing - option.  This diff adds a fallthrough so that -i is
handled as Unix 98 specifies.  This does not include a change for
the man page, I did not think it was necessary.

>How-To-Repeat:

env -i gives error about illegal option

>Fix:
	
*** /usr/src/usr.bin/env/env.c	Sun Dec  6 22:58:22 1998
--- /usr/local/src/env/env.c	Tue Aug 24 20:33:03 1999
***************
*** 60,67 ****
  	char *cleanenv[1];
  	int ch;
  
! 	while ((ch = getopt(argc, argv, "-")) != -1)
  		switch(ch) {
  		case '-':
  			environ = cleanenv;
  			cleanenv[0] = NULL;
--- 60,72 ----
  	char *cleanenv[1];
  	int ch;
  
! 	while ((ch = getopt(argc, argv, "i-")) != -1)		
  		switch(ch) {
+ 		case 'i':
+ 			/* 
+ 			 * For Unix 98 compatability.
+ 			 */
+ 			/* FALLTHROUGH */
  		case '-':
  			environ = cleanenv;
  			cleanenv[0] = NULL;

>Release-Note:
>Audit-Trail:

From: Bill Fumerola <billf@jade.chc-chimes.com>
To: James Howard <howardjp@wam.umd.edu>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability
Date: Tue, 24 Aug 1999 21:59:52 -0400 (EDT)

 On Tue, 24 Aug 1999, James Howard wrote:
 
 > + 			/* 
 > + 			 * For Unix 98 compatability.
 > + 			 */
 > + 			/* FALLTHROUGH */
 
 style(9) says this can be written as
 
 			/* For Unix 98 compatability. */
 			/* FALLTHROUGH */
 
 -- 
 - bill fumerola - billf@chc-chimes.com - BF1560 - computer horizons corp -
 - ph:(800) 252-2421 - bfumerol@computerhorizons.com - billf@FreeBSD.org  -
 
 
 
 
 

From: James Howard <howardjp@wam.umd.edu>
To: Bill Fumerola <billf@jade.chc-chimes.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability
Date: Tue, 24 Aug 1999 23:09:23 -0400 (EDT)

 On Tue, 24 Aug 1999, Bill Fumerola wrote:
 
 > style(9) says this can be written as
 > 
 > 			/* For Unix 98 compatability. */
 > 			/* FALLTHROUGH */
 
 Okay, here is a modified diff.  I also mispelled "compatibility" so I
 fixed that too.
 
 *** /usr/src/usr.bin/env/env.c	Sun Dec  6 22:58:22 1998
 --- /usr/local/src/env/env.c	Tue Aug 24 20:33:03 1999
 ***************
 *** 60,67 ****
   	char *cleanenv[1];
   	int ch;
   
 ! 	while ((ch = getopt(argc, argv, "-")) != -1)
   		switch(ch) {
   		case '-':
   			environ = cleanenv;
   			cleanenv[0] = NULL;
 --- 60,72 ----
   	char *cleanenv[1];
   	int ch;
   
 ! 	while ((ch = getopt(argc, argv, "i-")) != -1)		
   		switch(ch) {
 + 		case 'i':
 + 			/* For Unix 98 compatibility. */
 + 			/* FALLTHROUGH */
   		case '-':
   			environ = cleanenv;
   			cleanenv[0] = NULL;
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: howardjp@wam.umd.edu
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability 
Date: Wed, 25 Aug 1999 08:53:36 +0200

 On Tue, 24 Aug 1999 22:42:09 -0400, James Howard wrote:
 
 > ! 	while ((ch = getopt(argc, argv, "i-")) != -1)		
 >   		switch(ch) {
 > + 		case 'i':
 > + 			/* 
 > + 			 * For Unix 98 compatability.
 > + 			 */
 > + 			/* FALLTHROUGH */
 
 Hi James/Jamie (which do you prefer?),
 
 Bill Fumerola replied telling you that style(9) requires a slightly
 different format for your comments. While it's true, the example he gave
 you doesn't appear in style(9).
 
 I'd do this:
 
 		case 'i':		/* Unix 98 compatibility option */
 			/* FALLTHROUGH */
 
 Personally, I wouldn't provide the comment at all. Focus on the manpage
 instead. :-P
 
 Oh, and note the spelling of compatibility. :-)
 
 later,
 Sheldon.
 

From: James Howard <howardjp@wam.umd.edu>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability 
Date: Wed, 25 Aug 1999 17:57:56 -0400 (EDT)

 Due to the sheer number of complaints about my style here is a new patch
 for env which should make everyone happy :)  Following it is a diff to
 printenv.1.
 
 --- /usr/src/usr.bin/env/env.c	Sun Dec  6 17:58:22 1998
 +++ env.c	Wed Aug 25 17:45:39 1999
 @@ -60,8 +60,9 @@
  	char *cleanenv[1];
  	int ch;
  
 -	while ((ch = getopt(argc, argv, "-")) != -1)
 +	while ((ch = getopt(argc, argv, "i-")) != -1)		
  		switch(ch) {
 +		case 'i':
  		case '-':
  			environ = cleanenv;
  			cleanenv[0] = NULL;
 @@ -85,6 +86,6 @@
  usage()
  {
  	(void)fprintf(stderr,
 -	    "usage: env [-] [name=value ...] [command]\n");
 +	    "usage: env [-] [-i] [name=value ...] [command]\n");
  	exit(1);
  }
 
 ------------CUT HERE-----------------
 
 --- /usr/src/usr.bin/printenv/printenv.1	Mon Jul 12 16:23:52 1999
 +++ printenv.1	Wed Aug 25 17:45:42 1999
 @@ -45,6 +44,7 @@
  .Op Ar name
  .Nm env
  .Op Fl
 +.Op Fl i
  .Op Ar name=value ...
  .Op Ar command
  .Sh DESCRIPTION
 @@ -72,12 +72,20 @@
  .Ar name  ,
  with a value of
  .Ar value  .
 -The option
 -.Sq Fl
 -causes
 +The options to
 +.Nm env
 +are as follows:
 +.Pp
 +.Bl -tag -width indent
 +.It Fl
 +Force
  .Nm env
  to completely ignore the environment
  it inherits.
 +.It Fl i
 +Equivalent to
 +.Fl .
 +.El
  .Pp
  If no command is specified,
  .Nm env
 
 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: James Howard <howardjp@wam.umd.edu>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability 
Date: Thu, 26 Aug 1999 15:02:38 +0200

 On Wed, 25 Aug 1999 17:57:56 -0400, James Howard wrote:
 
 > -	while ((ch = getopt(argc, argv, "-")) != -1)
 > +	while ((ch = getopt(argc, argv, "i-")) != -1)		
 >  		switch(ch) {
 > +		case 'i':
 >  		case '-':
 
 You don't seem to have addressed the case disordering that Bruce
 commented on. :-)
 
 > +.It Fl i
 > +Equivalent to
 > +.Fl .
 
 This text begs the question "why?". I'd also suggest that the behaviour
 of the two options be described under -i, with - being declared the
 compatibility option. This should encourage people to use -i for
 portability. This is how the Single UNIX Spec does it. :-P
 
 Ciao,
 Sheldon.
 
 Index: usr.bin/printenv/printenv.1
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/printenv/printenv.1,v
 retrieving revision 1.3
 diff -u -d -r1.3 printenv.1
 --- printenv.1	1999/07/12 20:23:52	1.3
 +++ printenv.1	1999/08/26 13:02:02
 @@ -45,6 +45,7 @@
  .Op Ar name
  .Nm env
  .Op Fl
 +.Op Fl i
  .Op Ar name=value ...
  .Op Ar command
  .Sh DESCRIPTION
 @@ -72,12 +73,21 @@
  .Ar name  ,
  with a value of
  .Ar value  .
 -The option
 -.Sq Fl
 -causes
 +.Pp
 +The options are as follows:
 +.Bl -tag -width indent
 +.It Fl i
 +Execute the
 +.Ar command
 +with only those environment values specified. The environment inherited
 +by
  .Nm env
 -to completely ignore the environment
 -it inherits.
 +is ignored completely.
 +.It Fl
 +Identical to the
 +.Fl i
 +option, available for backward compatibility.
 +.El
  .Pp
  If no command is specified,
  .Nm env
 Index: usr.bin/env/env.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/env/env.c,v
 retrieving revision 1.4
 diff -u -d -r1.4 env.c
 --- env.c	1998/12/06 22:58:22	1.4
 +++ env.c	1999/08/26 12:57:34
 @@ -60,9 +60,10 @@
  	char *cleanenv[1];
  	int ch;
  
 -	while ((ch = getopt(argc, argv, "-")) != -1)
 +	while ((ch = getopt(argc, argv, "-i")) != -1)
  		switch(ch) {
  		case '-':
 +		case 'i':
  			environ = cleanenv;
  			cleanenv[0] = NULL;
  			break;
 @@ -85,6 +86,6 @@
  usage()
  {
  	(void)fprintf(stderr,
 -	    "usage: env [-] [name=value ...] [command]\n");
 +	    "usage: env [-] [-i] [name=value ...] [command]\n");
  	exit(1);
  }
 
Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Thu Aug 26 06:11:47 PDT 1999 
Responsible-Changed-Why:  
I'll take this one. 

From: James Howard <howardjp@wam.umd.edu>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13363: Patch to env(1) for Unix 98 compatability 
Date: Thu, 26 Aug 1999 23:16:49 -0400 (EDT)

 On Thu, 26 Aug 1999, Sheldon Hearn wrote:
 
 > This text begs the question "why?". I'd also suggest that the behaviour
 > of the two options be described under -i, with - being declared the
 > compatibility option. This should encourage people to use -i for
 > portability. This is how the Single UNIX Spec does it. :-P
 
 I completely agree with this but I didn't want to push it down their
 throats.  As I said previously, the draft of XPG6 removes ``-'' in favor
 of ``-i''.  To me, this means don't even bother documenting ``-'' and
 leave it in quietly as a compatibility option.  I personally view it as a
 bad idea to to have done ``-'' in the first place.  However, I was 7 when
 this was first done (possibly younger).  I will not question it further :)
 
 Jamie
 
 
State-Changed-From-To: open->analyzed 
State-Changed-By: sheldonh 
State-Changed-When: Fri Aug 27 01:59:38 PDT 1999 
State-Changed-Why:  
Committed to CURRENT. I'll leave it in this state for MFC. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: sheldonh 
State-Changed-When: Mon Dec 20 08:38:29 PST 1999 
State-Changed-Why:  
Damn, I left this in the wrong state for MFC.  Since it missed 
3.4-RELEASE, and since there isn't going to be another release 
thereafter on the RELENG_3 line, an MFC now  would be silly. 
>Unformatted:
