A stopped job make ash ignores exit

Roberto A. Foglietta roberto.foglietta at gmail.com
Sun Sep 12 03:59:48 UTC 2021


Hi all,

 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.

exitcmd(int argc UNUSED_PARAM, char **argv)
{
// These are the two lines responsible for the issue
// if (stoppedjobs())
// return 0;

 I suggest removing those two lines of code.
 In attachment to this email the test I did with the results for bash
and busybox ash.

 Best regards,
-- 
Roberto A. Foglietta
+39.349.33.30.697
-------------- next part --------------
################## TEST B ##################
hello by myecho() at line 27
FUNCNAME = , LINENO = 45, EXITSTATUS: 0
FUNCNAME = , LINENO = 46
hello by mytrue() at line 36
FUNCNAME = , LINENO = 47, EXITSTATUS: 0
FUNCNAME = , LINENO = 48
hello by myfalse() at line 31
FUNCNAME = , LINENO = 50
hello by myfalse() at line 31
FUNCNAME = , LINENO = 51, EXITSTATUS: 1
FUNCNAME = , LINENO = 52
hello by mytrue() at line 36
FUNCNAME = , LINENO = 53, EXITSTATUS: 0
FUNCNAME = , LINENO = 54
hello by myfalse() at line 31
ERROR: testB.sh failed in myfalse() at line 32, rc: 1
onerror() at line 16 == 16
ERROR: testB.sh failed at line 55, rc: 1
onerror() at line 16 == 16
FUNCNAME = , LINENO = 55, EXITSTATUS: 1
FUNCNAME = , LINENO = 56
hello by myexit() at line 22
exit in myexit() at line 1 == 60, EXITSTATUS: 1
exit in () at line 1 == 60, EXITSTATUS: 0
exit code 1
#############################################

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testB.sh
Type: text/x-sh
Size: 1550 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210912/0eaa5e16/attachment.sh>
-------------- next part --------------
################## TEST B ##################
hello by myecho() at line 27
FUNCNAME = , LINENO = 45, EXITSTATUS: 0
FUNCNAME = , LINENO = 46
hello by mytrue() at line 36
FUNCNAME = , LINENO = 47, EXITSTATUS: 0
FUNCNAME = , LINENO = 48
hello by myfalse() at line 31
FUNCNAME = , LINENO = 50
hello by myfalse() at line 31
FUNCNAME = , LINENO = 51, EXITSTATUS: 1
FUNCNAME = , LINENO = 52
hello by mytrue() at line 36
FUNCNAME = , LINENO = 53, EXITSTATUS: 0
FUNCNAME = , LINENO = 54
hello by myfalse() at line 31
ERROR: testB.sh failed in myfalse() at line 32, rc: 1
onerror() at line 16 == 16
ERROR: testB.sh failed at line 55, rc: 1
onerror() at line 16 == 16
FUNCNAME = , LINENO = 55, EXITSTATUS: 1
FUNCNAME = , LINENO = 56
hello by myexit() at line 22
should not print this!
exit in () at line 61 == 60, EXITSTATUS: 0
exit code 0
#############################################



More information about the busybox mailing list