[Bug 15970] New: ash: "wait -n" does not return when first pid exits

bugzilla at busybox.net bugzilla at busybox.net
Tue Mar 5 11:27:16 UTC 2024


https://bugs.busybox.net/show_bug.cgi?id=15970

            Bug ID: 15970
           Summary: ash: "wait -n" does not return when first pid exits
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: bastian at bastian-friedrich.de
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Hi,

busybox 1.31 introduced the bashism "wait -n". However, that command does not
behave the way I expect it to.

Bash's "wait -n" will return when the *first* pid returns; this is not the case
for the busybox ash.

In bash, the following script prints "5". In busybox ash, it prints "10".


```
#!/bin/sh

sleep 5 &
pid1=$!

sleep 10 &
pid2=$!

before=$(date +%s)
wait -n $pid1 $pid2
after=$(date +%s)

duration=$(( after - before ))
echo $duration
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list