Date:        Fri, 25 Sep 2026 15:10:30 +1200
    From:        Martin D Kealey <[email protected]>
    Message-ID:  
<can_u6mxvxrkhqjn7hzdrntc4v6t4cm65mczxdqcevtazhv2...@mail.gmail.com>

  | The significant change isn't any combination of «set -e», «set -o errexit»
  | and/or «shopt -s execfail», but rather the insertion of «exec».

You really should start paying a little more attention.   You completely
ignored the shopt -s execfail, which has the purpose of causing the exit
on failure of exec to not happen in interacive shells.

Really!

There clearly is an issue here - my guess is that the execfail shopt is
implemented by running the exec in a subshell (though how that would work
when the exec works I have no idea) - or some similar internal mechanism,
as it has many of the same characteristics it seems.   In a subshell, -e
kind of "starts again" in that it can ignore, inside that subshell that
outside of it, the -e would be being ignored  (just another wierdness with
-e that really makes it something best *never* used by handwritten scripts)
and so my guess is that somehow in the execfail on, errexit on, things are
getting confused internally, and the shell exits when it was intended not to.

As a bug worth fixing, I'd put this one way down the list, it is easy to
avoid - just don't use -e.   Ever.

kre

Reply via email to