Re: [rfc] posix.4 signals implementation

Alan Modra (alan@spri.levels.unisa.edu.au)
Fri, 16 May 1997 13:09:33 +0930 (CST)


>Trevor Johnson <trevor@jpj.net>:
> >Dean Gaudet <dgaudet-list-linux-kernel@arctic.org>:
> > While people are discussing posix signals I'd just like to point out again
> > that the 2.0 -> 2.0.1 changes for signal handling broke various binaries.
> > For example, to get a working bash (I don't think any distributions do
> > this) you have to -DBROKEN_WAITPID while building it. Here is an example
> > where it fails:
> >
> > cat >bad <<EOF
> > #!/bin/sh
> > ed $*
> > EOF
> > chmod +x bad
> > ./bad bad
> >
> > Now ^Z and fg that repeatedly. Eventually you'll hit a race condition
> > causing bash to exit and leave ed lying around. If you don't like ed,
> > replace it with vi (elvis or vim).
>
> I brought it to the foreground 62 times using ed, and 63 times with vi,
> but didn't see the problem. I know that doesn't prove there is no
> problem. I have:
>
> bash 2.00.0(1)-release, linked with glibc 2.0.3 and libtermcap 2.0.8

Interesting. With bash 1.14.7, libc-5.4.28, linux-2.0.30, I get a
problem with the ^Z, fg sequence if I run "./bad bad" on a text
virtual console, but no problem shows up when running from an xterm.

I'm guessing it's something to do with text virtual consoles. Here's
another text virtual console problem

cat > bad2 <<EOF
#! /bin/sh
while date > /dev/tty; do sleep 1; done
EOF
chmod a+x bad2

Now run bad2 on two or more virtual consoles, and ^S on one of them.
They all stop producing date output!