Hello BusyBox maintainers,

I found an inconsistent behavior of `wait -n` with Bash.
It still blocks when a job gets killed by a signal.
As this is a bashism but it differs from Bash's behavior,
it may be a bug.


**Steps to Reproduce**:
1. Run the following script in ash:
   --------------------------------------------
   #!/bin/sh
   sleep 1000 &
   sleep 100 &
   echo "$!"  # Prints PID of the second sleep
   wait -n    # Should return when either sleep finishes
   echo "wait -n exited"
   --------------------------------------------

2. Kill the second `sleep` process (PID from `echo $!`):
   `kill -TERM <PID>` or `kill -KILL <PID>`

**Expected Behavior**:
- `wait -n` should immediately return after the job is killed".

**Observed Behavior**:
- `wait -n` continues to block, waiting for the remaining
  `sleep 1000` job.

**Environment**:
- Busybox Docker image: BusyBox v1.37.0 (2024-09-26 21:31:42 UTC)
- Architecture: x86_64

**Additional Notes**:
- Tested with SIGTERM and SIGKILL.
- Works as expected in Bash but not in BusyBox ash.
- The issue occurs when a job is terminated by a signal
  but not when it exits normally.

Could this be a bug or is it expected behavior? Thank you for your time.

Best regards,
Maks

_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox

Reply via email to