bug-bash
[Top][All Lists]
Advanced

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

Re: Possible regression in 'wait' command


From: Chet Ramey
Subject: Re: Possible regression in 'wait' command
Date: Sun, 16 May 2021 12:46:09 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

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    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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