🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #376

A bug... I think.

#376
From: Mark Buda
Date: Tue, 25 Jul 1989 03:34
42 lines
1741 bytes
Hello again. I'm running bash 1.02 under Genix 4.1 on a box with lots of cables
hanging out of it. I think I've found a bug, but I'm not absolutely sure. It's
certainly an incompatibility with my /bin/sh.

The symptom: after executing a "." command, bash forgets the value of $2 (for
instance).

The following script should print its first argument, but instead it prints
a blank line.

-- cut here --
#! /usr/local/bin/bash
. /dev/null
echo $1
-- cut here --

After thinking a bit, I discovered that if I replace the second line with
. /tmp/moo foobie
where /tmp/moo is a file containing the line
echo $1
bash will print foobie twice. Apparently bash is sticking the parameters from
the "." line into dollar_vars instead of saving the old values and restoring
them.

Is the fix anything more complicated than replacing
      remember_args (list->next, 1);
      string[finfo.st_size] = '\0';
      return (parse_and_execute (string));
with
      push_dollar_vars();
      remember_args (list->next, 1);
      string[finfo.st_size] = '\0';
      temp = parse_and_execute (string);
      pop_dollar_vars();
      return temp;
or should I use p{ush,op}_context, or what?

Mark Buda
hermit@chessene.uucp
hermit%chessene.uucp@rutgers.edu
devon.lns.pa.us!chessene!hermit
...!rutgers!devon!chessene!hermit
Technical Details
Message-ID: <8907242334.AA07978@chessene.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!cica!tut.cis.ohio-state.edu!devon.lns.pa.us!chessene!root

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!cica!tut.cis.ohio-state.edu!devon.lns.pa.us!chessene!root
From: chessene!root@devon.lns.pa.us (Mark Buda)
Newsgroups: gnu.bash.bug
Subject: A bug... I think.
Message-ID: <8907242334.AA07978@chessene.uucp>
Date: 25 Jul 89 03:34:02 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 42