On 5/13/21 3:44 PM, Jonas Alfredsson via Bug reports for the GNU Bourne Again SHell wrote:

Bash Version: 5.1
Patch Level: 0
Release Status: release

Description:
If one has a script similar to this:

```bash
trap 'echo "Received SIGHUP"' HUP

sleep 5m &
child_pid=$!

wait -n ${child_pid}
wait -n ${child_pid}
```

and you send in the system signal SIGHUP the first `wait` will exit (as 
expected)
and the message "Received SIGHUP" will be printed. However, since we have a
second `wait` it should catch further execution and wait for the child once 
again.

Thanks for the report. The issue is a change between bash-5.0 and bash-5.1
to understand PID arguments with -n. The job state wasn't restored upon
receipt of all trapped signals and interfered with subsequent calls to
`wait -n'.

Chet

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

  • Possible r... Jonas Alfredsson via Bug reports for the GNU Bourne Again SHell
    • Re: P... Alex fxmbsw7 Ratchev
    • Re: P... Robert Elz
      • R... Jonas Alfredsson
        • ... Alex fxmbsw7 Ratchev
        • ... Robert Elz
    • Re: P... Chet Ramey
      • R... Jonas Alfredsson
        • ... Chet Ramey
          • ... Jonas Alfredsson

Reply via email to