odd suspend/fg problem

Dean Gaudet (dgaudet@arctic.org)
Wed, 18 Dec 1996 00:35:41 -0800


I'm seeing some weird problems with ^Z/fg. It's very reproduceable
on two different machines (one slackware w/2.0.26, the other redhat
w/2.0.27 smp), using tcsh or bash (tcsh 6.06, bash 1.14.6 and 1.14.7)
It occurs when I suspend an editor (tested with vim-4.5, elvis, and even
ed) that is a child of a child of the shell.

Here is a quick way to reproduce it:

cat <<EOF >bad
#!/bin/sh
${VISUAL-${EDITOR-vi}} $*
echo bad done
EOF
chmod +x bad

Then do "./bad bad" and ^Z/fg a few times. Within 3 or 4 tries it will
typically fail to resume, kill the task, and drop back to the shell.

If you change that "bad" script to use /bin/csh the problem doesn't occur.
A ~v launched editor from within mail also doesn't exhibit the problem.
But an editor launched inside "comp" from mh (6.8.4 based on debian
sources) does exhibit the problem.

I'm pretty sure I've eliminated a bunch of variables by trying this with
so many setups. In particular, since it fails with ed I don't really
think it has anything to do with the editor involved. It also doesn't
seem to be affected by the interactive shell (but csh doesn't seem to
exhibit the problem when it is running as the child). The stty tostop
setting doesn't seem to affect it either. So maybe it's a kernel problem.

Can someone else verify this? I want to know if it's something else
that's the same between my systems I haven't eliminated yet.

Dean