🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Mark Buda Tue, 25 Jul 1989 03:34
A bug... I think.
#376
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads