]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Move more code out of shell traps into shell functions.
authorZack Weinberg <zack@owlfolio.org>
Tue, 27 May 2025 18:26:18 +0000 (14:26 -0400)
committerZack Weinberg <zack@owlfolio.org>
Mon, 26 Jan 2026 19:29:49 +0000 (14:29 -0500)
Follow-up on 416b8f50c9bd4e38f9bc48b946505d2a18f6b1fd.

* lib/autoconf/general.m4 (_AC_INIT_PREPARE): Emit function ac_exit_trap,
  move remaining code from the 'trap 0' command to ac_exit_trap.

lib/autoconf/general.m4

index e94f9b00afbe3d056a77b1e1f03c914021d83f55..900ba1e064d269cc5abe00baf5dd7e4210235f6e 100644 (file)
@@ -1363,11 +1363,10 @@ ac_dump_debugging_info ()
 }
 
 # When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
+# config.log.
+ac_exit_trap ()
+{
+  exit_status=$1
   # Sanitize IFS.
   IFS=" ""     $as_nl"
   # Save into config.log some information that might help in debugging.
@@ -1375,7 +1374,11 @@ trap 'exit_status=$?
   eval "rm -f $ac_clean_CONFIG_STATUS core *.core core.conftest.*" &&
     rm -f -r conftest* confdefs* conf$[$]* $ac_clean_files &&
     exit $exit_status
-' 0
+}
+
+dnl To minimize quoting issues, put as little code as possible in traps.
+dnl Do not start any trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'ac_exit_trap $?' 0
 for ac_signal in 1 2 13 15; do
   trap 'ac_signal='$ac_signal'; AS_EXIT([1])' $ac_signal
 done