On 10/5/18 9:33 PM, Mike Gerwitz wrote:
> The following code will cause a segfault on bash-4.4.19(1) on
> GNUÂ Guix. I reproduced the issue on an old Ubuntu 14.04 LTS running
> bash-4.3.11(1) as well as a Trisquel system running the same version.
>
> bash -c 'trap "kill 0" TERM; kill 0'
>
> Also segfaults when replacing `0' with `$$', and presumably in any other
> situation that would trigger the trap recursively.
Yes. Bash has allowed recursive trap handlers since early 2014 (pre-4.3)
due to requests for the feature and compatibility with other shells that
allow it.
If you manage to create infinite recursion, bash won't stop you.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/