On Mon, 10 Oct 2022 20:58:29 -0000, Klemens Nanni wrote: > The ERR trap is supposed to be run once, regardless of errexit: > > $ ksh -c 'trap "echo ERR" ERR; false' > ERR > $ ksh -c 'trap "echo ERR" ERR; false' -e > ERR > ERR > > This duplication is a regression of the following bin/ksh/main.c commit: > > revision 1.52 > date: 2013/06/15 17:25:19; author: millert; state: Exp; lines: +5 -1 > ; > Run any pending traps before calling the EXIT or ERR traps when -e > is set. Fixes a bug where we would not run the signal trap if, > for example, ^C was pressed and -e was set. OK espie@ > > Revert it and add a new test, matching bash(1) behaviour: > > $ ./obj/ksh -c 'trap "echo ERR" ERR; false' > ERR > $ ./obj/ksh -c 'trap "echo ERR" ERR; false' -e > ERR > > After that, fix signal handlers (e.g. SIGINT/^C traps) properly.
OK. - todd
