Re: Midnight Commander /tmp race

Pavel Kankovsky (peak@kerberos.troja.mff.cuni.cz)
Wed, 18 Mar 1998 11:27:46 +0100

On Wed, 18 Mar 1998 willy@snowyowl.csu.ac.ru wrote:

> > mc()
> > {
> > MC=`/usr/bin/mc -P "$@"`
> > [ -n "$MC" ] && cd $MC
> > unset MC
> > }
>
> Nope. This (rather old) version breaks Ctrl-O for nonroot bash
> instances. However it works with Bourne shell.

It is the "suspend key" (ctrl-z by default) but I get the point.

bash 1.14.7, bash 2.00.0, and Solaris 2.5 ksh lock hard when the command
in `` (or $()) is suspended.

tcsh 6.06, Sol 2.5 csh, and Sol 2.5 jsh (sh + job control) disregard
ctrl+z when processing the command in ``.

Nevertheless, the function using a temporary file is not perfect either:
it allows the user to suspend mc but when as the process is stopped
the shell executes the rest of the function immediately (is it a bug or a
feature?) and the desired effect is lost.

--Pavel Kankovsky aka Peak [ Boycott Microsoft -- http://www.vcnet.com/bms ]

P.S. There are probably many dark cornerns in the job control:
for instance, ``command1 && command2'' and ``command1 || command2''.

What should happen when command1 is suspended?

bash assumes command1 exits with code 0, csh seems to discard command2,
jsh does not allow to suspend command1.