Il giorno dom 22 ago 2021 alle ore 02:23 Harald van Dijk <[email protected]> ha scritto:
> On 22/08/2021 00:31, Roberto A. Foglietta wrote: > > Il giorno sab 21 ago 2021 alle ore 23:33 Harald van Dijk > > <[email protected] <mailto:[email protected]>> ha scritto: > > > > Hi again, > > > > Another bug: the exit status is not preserved. > > > > Consider > > > > busybox ash -c 'trap "echo ERR" ERR; false; echo $?' > > > > This prints ERR, and then 0, because the echo command completed > > successfully. It is supposed to print ERR, and then 1, because like > > EXIT > > actions, ERR actions are supposed to preserve the exit status of the > > last command before the action was invoked. > > > > > > Patch 11 and testsuite attached. > > In the test suite two cases are evaluated exit status =0 !0 > > I think that's probably correct but suboptimal. You're saving exitstatus > using the savestatus global variable, but in that block, you already > know that exitstatus is always going to be equal to the local status > variable: the only time that exitstatus != status is if the earlier > exitstatus = status; assignment is bypassed, but the only way that can > get bypassed is if evaltree(NULL, flags) is called, in which case status > will equal 0 so the block never gets entered. You should be able to > repeat the earlier exitstatus = status; assignment without saving it in > a new variable. > It is just an assignment but it is ok. It is included in patch 12th. With the patch 12th, I have solved a case in test 6, exit 0 in function. It was not printing the function name. However, for dealing with this case I have set a condition on (e) but I am not 100% sure that every time (e) is set, then exit. before ################## TEST 6 ################## ciao! at line 29 == 29 hello by mytest() at line 22 == 22 exit in () at line 30 == 30 with pippo but not pluto ############################################# after ################## TEST 6 ################## ciao! at line 29 == 29 hello by mytest() at line 22 == 22 exit in mytest() at line 30 == 30 with pippo but not pluto #############################################
busybox-1.33.1-12of12-FUNCNAME-exit-in-function.patch
Description: Binary data
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
