A stopped job make ash ignores exit

Ron Yorston rmy at pobox.com
Sun Sep 12 07:15:29 UTC 2021


Roberto A. Foglietta wrote:
> I found a case in which IMHO the ash does not behave as expected by a shell.
> When there is a stopped job the exit command is ignored but it should not.
> At least bash does not ignore the exit if a stopped job exists.

Warning about stopped jobs is OK in an interactive shell.  Bash does
that too.  The difference is that BusyBox ash (and dash) issues the
warning in a non-interactive shell, which it probably shouldn't do.

Possible alternative fix below.

Ron
---

diff --git a/shell/ash.c b/shell/ash.c
index 3524d046e..d163ec8e3 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5451,7 +5451,7 @@ stoppedjobs(void)
 	int retval;
 
 	retval = 0;
-	if (job_warning)
+	if (iflag || job_warning)
 		goto out;
 	jp = curjob;
 	if (jp && jp->state == JOBSTOPPED) {


More information about the busybox mailing list