]> git.ipfire.org Git - thirdparty/autoconf.git/commit
_AS_REEXEC_WITH_SHELL: don’t use AS_EXIT.
authorZack Weinberg <zackw@panix.com>
Fri, 13 Mar 2020 17:38:46 +0000 (13:38 -0400)
committerZack Weinberg <zackw@panix.com>
Fri, 13 Mar 2020 17:38:46 +0000 (13:38 -0400)
commitb2e4b6333785aa55814bfd8f8747a9ce948fa88e
tree8433c3a5213083a7667d209a9ec02dd0bd859c65
parent2d06297bd550a0015f3ccedda9f43d7c616cfaf8
_AS_REEXEC_WITH_SHELL: don’t use AS_EXIT.

If _AS_REEXEC_WITH_SHELL fails to exec the selected “better” shell
interpreter, and that failure somehow doesn’t terminate the process,
it calls AS_EXIT([255]).  This expands to an invocation of as_fn_exit.
However, the definition of as_fn_exit goes into the M4SH-INIT-FN
diversion, whereas _AS_REEXEC_WITH_SHELL goes into the M4SH-SANITIZE
diversion, so as_fn_exit won’t be defined at the point of this use.
We can’t move the definition of as_fn_exit earlier, because we don’t
know that the shell supports shell functions until after we get to the
end of the M4SH-SANITIZE diversion.

This is only a theoretical bug because, as the comments say, “all the
known shells bail out after a failed exec.”  However, a shell that
doesn’t bail out will instead give the user a flood of nonsensical
error messages (starting with “as_fn_exit: not found” and then going
on to choke on the rest of the script) so I think we should fix it
anyway.  There shouldn’t be any problem with using a plain ‘exit’ at
this point; no traps are active yet, and we are exiting with an
explicit error code.
lib/m4sugar/m4sh.m4