🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #362

Positional parameters lost when setting flags (with fix)

#362
From: Rob McMahon
Date: Wed, 19 Jul 1989 18:27
109 lines
2992 bytes
(Bash claims to be 1.02, although some of the patches I've seen in this group
don't quite seem to tie in.)

When you set a flag (e.g. `set -f'), the positional parameters are lost.
Here's a typescript to show what I mean.  `./bash' refers to bash after adding
the fix at the end of this script.

Script started on Wed Jul 19 19:13:26 1989
bash$ echo $-
io
bash$ echo $@

bash$ set gronk grimble
bash$ echo $@
gronk grimble
bash$ set -f
bash$ echo $-
fio
bash$ echo $@
			<= positional parameters have gone away
bash$ sh
$ echo $-
s
$ echo $@

$ set gronk grimble
$ echo $@
gronk grimble		<= okay with normal shell
$ set -f
$ echo $-
sf
$ echo $@
gronk grimble
$
bash$ ./bash
bash$ echo $-
o
bash$ echo $@

bash$ set gronk grimble
bash$ echo $@
gronk grimble
bash$ set -f
bash$ echo $-
fo
bash$ echo $@
gronk grimble
bash$ x
bash$ 
script done on Wed Jul 19 19:16:17 1989

There's also a patch in here to fix the documentation for `test'.

BTW.  Could Brian Fox ack this please, I've a sneaky suspicion these bug
reports aren't getting to him.  I'm posting them to gnu.bash.bug, should I be
mailing them to some other address (unknown to me) instead ?  Should this
group in fact be moderated with some mailing list address as the moderator ?
If I'm doing things wrong, could someone else let me know.

Thanks,

Rob

===================================================================
RCS file: builtins.c,v
retrieving revision 1.4
diff -c -r1.4 builtins.c
*** /tmp/,RCSt1a00923	Wed Jul 19 19:21:27 1989
--- builtins.c	Wed Jul 19 19:04:10 1989
***************
*** 339,345 ****
  \n\
  	String operators:\n\
  \n\
! 	-n STRING	True if string is empty.\n\
  	STRING		True if string is not empty.\n\
  	STRING1 = STRING2\n\
  			True if the strings are equal.\n\
--- 339,346 ----
  \n\
  	String operators:\n\
  \n\
! 	-z STRING	True if string is empty.\n\
! 	-n STRING	True if string is not empty.\n\
  	STRING		True if string is not empty.\n\
  	STRING1 = STRING2\n\
  			True if the strings are equal.\n\
***************
*** 1672,1678 ****
      }
  
    /* Assigning $1 ... $n */
!   remember_args (list, 1);
  }
  
  
--- 1673,1680 ----
      }
  
    /* Assigning $1 ... $n */
!   if (list)
!     remember_args (list, 1);
  }
  
  
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
Technical Details
Message-ID: <173@titania.warwick.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!warwick!cudcv

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!warwick!cudcv
From: cudcv@warwick.ac.uk (Rob McMahon)
Newsgroups: gnu.bash.bug
Subject: Positional parameters lost when setting flags (with fix)
Message-ID: <173@titania.warwick.ac.uk>
Date: 19 Jul 89 18:27:34 GMT
Reply-To: cudcv@warwick.ac.uk (Rob McMahon)
Organization: Computing Services, Warwick University, UK
Lines: 109