← Commit list

5e0411a7f

Denys Vlasenko
Denys Vlasenko
2023-07-10
SUCCESS Duration: 154s

Subject

ash: disable sleep as builtin, closes 15619

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

include/libbb.h+2 -0
@@ -1513,6 +1513,8 @@ int hush_main(int argc, char** argv) IF_SHELL_HUSH(MAIN_EXTERNALLY_VISIBLE);
/* If shell needs them, they exist even if not enabled as applets */
int echo_main(int argc, char** argv) IF_ECHO(MAIN_EXTERNALLY_VISIBLE);
int sleep_main(int argc, char **argv) IF_SLEEP(MAIN_EXTERNALLY_VISIBLE);
+/* See disabled "config ASH_SLEEP" in ash.c */
+#define ENABLE_ASH_SLEEP 0
int printf_main(int argc, char **argv) IF_PRINTF(MAIN_EXTERNALLY_VISIBLE);
int test_main(int argc, char **argv)
#if ENABLE_TEST || ENABLE_TEST1 || ENABLE_TEST2
shell/ash.c+17 -5
@@ -134,11 +134,23 @@
//config: default y
//config: depends on SHELL_ASH
//config:
-//config:config ASH_SLEEP
-//config: bool "sleep builtin"
-//config: default y
-//config: depends on SHELL_ASH
-//config:
+//
+////config:config ASH_SLEEP
+////config: bool "sleep builtin"
+////config: default y
+////config: depends on SHELL_ASH
+////config:
+//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//Disabled for now. Has a few annoying problems:
+// * sleepcmd() -> sleep_main(), the parsing of bad arguments exits the shell.
+// * sleep_for_duration() in sleep_main() has to be interruptible for
+// ^C traps to work, which may be a problem for other users
+// of sleep_for_duration().
+// * BUT, if sleep_for_duration() is interruptible, then SIGCHLD interrupts it
+// as well (try "/bin/sleep 1 & sleep 10").
+// * sleep_main() must not allocate anything as ^C in ash longjmp's.
+// (currently, allocations are only on error paths, in message printing).
+//
//config:config ASH_HELP
//config: bool "help builtin"
//config: default y