[git commit] ash: return exit status of nofork applets (again)

Denys Vlasenko vda.linux at googlemail.com
Thu Feb 20 09:39:46 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=d5bfe26c457a97a8b525b6c27f5498525a5829bf
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Since commit d81af7216 (ash: eval: Reap zombies after built-in commands
and functions) if the shell is compiled with SH_STANDALONE and SH_NOFORK
enabled nofork applets potentially return the incorrect status.

The status value returned by evalcommand() in this case is obtained from
exitstatus in a call to waitforjob(NULL).  This overwrites the status
set for nonfork applets.

If this commit seems familiar it's essentially a reversion of commit
5ccb0e92fa (ash: return exit status of nofork applets).  What was correct
in 2016 is wrong in 2020 and vice versa.

Signed-off-by: Ron Yorston <rmy at pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell/ash.c b/shell/ash.c
index 6087416ab..a6f777800 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10351,7 +10351,7 @@ evalcommand(union node *cmd, int flags)
 			 * and/or wait for user input ineligible for NOFORK:
 			 * for example, "yes" or "rm" (rm -i waits for input).
 			 */
-			status = run_nofork_applet(applet_no, argv);
+			exitstatus = run_nofork_applet(applet_no, argv);
 			environ = sv_environ;
 			/*
 			 * Try enabling NOFORK for "yes" applet.


More information about the busybox-cvs mailing list