[bosh] Freeze when using pipe
A Tool Box with tools written or managed by Jörg Schilling
Brought to you by:
schily
Using Schily Tools 2020-03-27 on Debian 10.3.
echo 'test' | cat - | while read line; do
/bin/echo "$line" # Freeze
done
On terminal
$ echo 'test' | cat - | while read line; do
> /bin/echo "$line"
> done
test
[1] + Stopped (tty input) echo 'test' | cat - | while read line; do /bin/echo "$line"; done
There is no freeze, but there is a problem with jobcontrol in the default new version of the shell that uses vfork.
If you recompile bosh using:
smake COPTX=-DNO_VFORK
it does not have the mentioned job control problems.
I would need to check this problem, but this may take some time...
The first problem with the script was caused by a bug in the special code to allow
read to run in the foreground shell. The tricks just should not be used for
the child processes for the read conatining loop.
The second example did not fail on Solaris and it seems that it also does
no longer fail on Linux if the fix for the script has been applied. See attached patch.
Last edit: Jörg Schilling 2020-04-26
It seems to work on Linux. Thanks.
BTW, I applied by hand because the patch cannot be applied with
patch -i ./0due to the error.Ahh, I see that I forgot to use -u with "sccs diffs", but patch still should be able to deal with that output.
Closed as it is fixed in the next release.