[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

5.0 regression: Script stuck when waiting in trap

From: mwnx
Subject: 5.0 regression: Script stuck when waiting in trap
Date: Sun, 2 Jun 2019 13:55:10 +0200
User-agent: Mutt/1.9.4 (2018-02-28)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-Dl674z/bash-5.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall 
-Wno-parentheses -Wno-format-security
uname output: Linux cbb62a3d8393 4.15.0-50-generic #54-Ubuntu SMP Mon May 6 
18:46:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 3
Release Status: release

        Since bash 5.0, a subshell can get stuck (wait forever) in
        what looks like a pretty specific set of circumstances,
        namely when combining a group command or a function call
        with process substitution and attempting to `wait` for said
        group command or function from within a trap.

        I ran a git bisect to pinpoint when exactly the regression
        was introduced and it looks like it happened in [1].

        [1] d233b485 (tag: bash-5.0) bash-5.0 distribution sources and 

        $ cat <<'EOF' | bash
            trap 'wait' EXIT
            { sleep 2; } > >(cat)
        ) &
        sleep 1
        kill $!
        <ctrl-C after a few seconds of waiting>
        # The process is actually still alive, even after ctrl-C...
        $ pstree -p

        Replacing `{ sleep 2; }` above with `f() { sleep 2; }; f`
        gives the same result. On the other hand, replacing it with
        plain `sleep 2`, or `(sleep 2)` eliminates the problem.

GPG: AEC9 554B 07BD F60D 75A3  AF6A 44E8 E4D4 0312 C726

reply via email to

[Prev in Thread] Current Thread [Next in Thread]