| Summary: | Odd beavor of loops with async sleep in 1.136 | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | foosinn <busybox> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | busybox-cvs, manhongdai, tero.saarni |
| Priority: | P5 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
|
Description
foosinn
2023-06-05 12:52:15 UTC
This is because of built-in sleep [1] introduced in BusyBox 1.36.0 which exits when receiving SIGCHLD. Here is another way how to reproduce: /bin/sleep 1 & sleep 10 The purpose of the first command it to trigger SIGCHLD after one second. The second command should sleep for 10 seconds. - If running it in busybox, the command sequence exits after 1 second - If running it in bash, the command sequence exits after 10 second Similar problem was previously reported for "read" [2] and fix [3] was applied for it. -- Tero [1] https://git.busybox.net/busybox/commit/?id=58598eb7093561d914a6254697e137b815f1fdfc [2] https://www.mail-archive.com/busybox@busybox.net/msg24147.html [3] https://git.busybox.net/busybox/commit/?id=f5470419404d643070db99d058405b714695b817 Having a second look, I think it was this fix [1] that causes the problem as a side effect. It was released in 1.36.1. [1] https://git.busybox.net/busybox/commit/?h=1_36_1&id=ce839dea92ce10627094096835e831bf5d267631 *** Bug 15631 has been marked as a duplicate of this bug. *** I marked bug 15631 as a duplicate of this bug. Before this bug is fixed, we can add a pair of parenthesis as a workaround. The "bug.sh" below demonstrates that "sleep 10" doesn't sleep, while the "fix.sh" shows the workaround pi:~# ./bug.sh Sun Jul 9 12:05:09 UTC 2023 Sun Jul 9 12:05:09 UTC 2023 pi:~# ./fix.sh Sun Jul 9 12:05:12 UTC 2023 Sun Jul 9 12:05:22 UTC 2023 pi:~# cat bug.sh date & sleep 10 date pi:~# cat fix.sh ( date & ) sleep 10 date I'm disabling sleep builtin in ash, with a comment describing problems. |