It's the infinite loop of trapped SIGTERMs that raises this exception, and can be performed in any way that deliberately infinitely loops a signal trap.
$ bash -c 'trap "kill 0" EXIT SIGTERM' Segmentation fault (core dumped)
$ bash -c 'trap "kill $$" EXIT SIGTERM' Segmentation fault (core dumped)
$ bash -c 'trap "kill 0" SIGTERM; kill 0' Segmentation fault (core dumped)
$ bash -c 'trap "kill -USR1 $$" SIGUSR1; while :; do :; done' & [1] 18769 $ kill -USR1 18769 [1]+ Segmentation fault (core dumped) bash -c 'trap "kill -USR1 $$" SIGUSR1; while :; do :; done'
bash_4.3-6ubuntu1 is the first version that exhibits this behaviour; versions <= bash_4.2-5ubuntu3 are not susceptible.
$ bash_4.2-5ubuntu3_amd64/bin/bash -c 'trap "echo trap; kill 0" EXIT SIGTERM' trap trap trap
$ bash_4.2-5ubuntu3_amd64/bin/bash -c 'trap "echo trap; kill 0" SIGTERM; kill 0' trap trap
$ bash_4.3-6ubuntu1_amd64/bin/bash -c 'trap "echo trap; kill 0" EXIT SIGTERM' trap trap trap trap [...] trap trap Segmentation fault (core dumped)
It's the infinite loop of trapped SIGTERMs that raises this exception, and can be performed in any way that deliberately infinitely loops a signal trap.
$ bash -c 'trap "kill 0" EXIT SIGTERM'
Segmentation fault (core dumped)
$ bash -c 'trap "kill $$" EXIT SIGTERM'
Segmentation fault (core dumped)
$ bash -c 'trap "kill 0" SIGTERM; kill 0'
Segmentation fault (core dumped)
$ bash -c 'trap "kill -USR1 $$" SIGUSR1; while :; do :; done' &
[1] 18769
$ kill -USR1 18769
[1]+ Segmentation fault (core dumped) bash -c 'trap "kill -USR1 $$" SIGUSR1; while :; do :; done'
bash_4.3-6ubuntu1 is the first version that exhibits this behaviour; versions <= bash_4.2-5ubuntu3 are not susceptible.
$ bash_4. 2-5ubuntu3_ amd64/bin/ bash -c 'trap "echo trap; kill 0" EXIT SIGTERM'
trap
trap
trap
$ bash_4. 2-5ubuntu3_ amd64/bin/ bash -c 'trap "echo trap; kill 0" SIGTERM; kill 0'
trap
trap
$ bash_4. 3-6ubuntu1_ amd64/bin/ bash -c 'trap "echo trap; kill 0" EXIT SIGTERM'
trap
trap
trap
trap
[...]
trap
trap
Segmentation fault (core dumped)