mbox series

[0/1] man: Clarify the `trap` condition `EXIT`

Message ID 20241023195623.148722-1-calestyo@scientia.org (mailing list archive)
Headers show
Series man: Clarify the `trap` condition `EXIT` | expand

Message

Christoph Anton Mitterer Oct. 23, 2024, 7:55 p.m. UTC
Hey.

It seems that in dash the meaning of the EXIT condition of trap is only for
"normal" exits from the shell, but not e.g. on SIGINT and the likes.
Unlike e.g. bash, which also executes that trap on such signals (other than
SIGKILL of course).


POSIX allows this https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_29:
The EXIT condition shall occur when the shell terminates normally (exits), and
may occur when the shell terminates abnormally as a result of delivery of a
signal (other than SIGKILL) whose trap action is the default.

But I think it would make sense to have it documented, especially as even on
SIGINT/etc. the shell does "exit" in the plain meaning of the word.

[If Chet reads along, it might also make sense to document the opposite in
bash.]


Could be as simple as the following patch.


Cheers,
Chris.