Wolfgang Zekoll wrote on Thu, Nov 06, 2025 at 10:07:09PM +0000: > There are two bugs here: > > 1. `129` is not the return code from the exited child. > 2. `wait -n` should return `127` when no child/job is > running.
Wow, I was just looking at that ! And it's been broken for 5 years... There's a third bug: `sleep 2 | sleep 1 & wait -n` only waits one second... This is a test that's written in the code comment :( I only found out about the return 127 problem after fixing the other two and held my patch for the other two bugs, but it's now done and I sent two patches, with test attached. > The following patch should fix both issues. I can confirm this fixes the two you listed but not my third, at the cost of a bit of a size increase: function old new delta dowait 608 660 +52 waitcmd 277 280 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 55/0) Total: 55 bytes The return status also aren't correct when waiting for already done processes: ``` ./busybox_unstripped sh -c 'sleep 0.5 & sh -c "sleep 1; exit 3" & p1=$!; sleep 2; wait -n; echo $?' 127 ``` As far as I can tell my patches address all issues (you're in cc), it'd be great if you could test as well and perhaps comment on the implementation as you've had a look Thanks, -- Dominique Martinet | Asmadeus _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
