Re: [BUG] exit status of subshells in traps is always 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 27-11-18 om 17:24 schreef Martijn Dekker:
Big bad bug: it appears that subshells always return status 0 in traps.

Bug found in dash 0.5.9 and later.

In fact, the bug exists on at least dash 0.5.6 and possibly earlier (earlier versions don't compile for me) if the exit occurs due to a failure in an assignment or special builtin.

$ cat BUG_TRAPSUB0.sh
(trap '(! :) && echo BUG1' EXIT)
(trap '(false) && echo BUG2' EXIT)
(trap 'readonly foo=bar; (foo=baz) && echo BUG3' EXIT)
(trap '(set -o bad@option) && echo BUG4' EXIT)
$ dash-0.5.6 BUG_TRAPSUB0.sh
BUG_TRAPSUB0.sh: 1: foo: is read only
BUG3
set: 1: Illegal option -o bad@option
BUG4
$ #	[Same for 0.5.6.1, 0.5.7, 0.5.8]
$ dash-0.5.9 BUG_TRAPSUB0.sh
BUG1
BUG2
BUG_TRAPSUB0.sh: 1: BUG_TRAPSUB0.sh: foo: is read only
BUG3
BUG_TRAPSUB0.sh: 1: set: Illegal option -o bad@option
BUG4
$ #	[Same for 0.5.9.1, 0.5.10, 0.5.10.1, 0.5.10.2]

Thanks,

- M.



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux