Menu

#18 [bosh] Freeze when using pipe

1.0
closed
nobody
None
2020-04-28
2020-04-16
No

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
1 Attachments
0

Discussion

  • Jörg Schilling

    Jörg Schilling - 2020-04-17

    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...

     
  • Jörg Schilling

    Jörg Schilling - 2020-04-25

    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
  • Koichi Nakashima

    It seems to work on Linux. Thanks.

    BTW, I applied by hand because the patch cannot be applied with patch -i ./0 due to the error.

    patch: **** Only garbage was found in the patch input.

     
  • Jörg Schilling

    Jörg Schilling - 2020-04-26

    Ahh, I see that I forgot to use -u with "sccs diffs", but patch still should be able to deal with that output.

     
  • Jörg Schilling

    Jörg Schilling - 2020-04-28
    • status: open --> closed
     
  • Jörg Schilling

    Jörg Schilling - 2020-04-28

    Closed as it is fixed in the next release.

     

Log in to post a comment.

MongoDB Logo MongoDB