diff --git a/ChangeLog b/ChangeLog index db9286ea..25ce5e58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-06-02 Pavel Roskin + + * acgeneral.m4 (_AC_INIT_PREPARE): Don't rely on $? in the traps + for signals other than 0 - exit with code 1. + * m4sh.m4 (AS_TMPDIR): Likewise. + * autoconf.in: Likewise. Also don't rely on exit == exit $?. + * autoheader.in: Likewise. + * autoreconf.in: Likewise. + * tests/torture.at (Signal handling): New test for the above. + 2001-06-01 Akim Demaille * m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Clarify the error diff --git a/acgeneral.m4 b/acgeneral.m4 index 6897f116..94fd84a4 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1472,7 +1472,7 @@ trap 'exit_status=$? exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_status=$?; ac_signal='$ac_signal'; AS_EXIT([$ac_status])' $ac_signal + trap 'ac_signal='$ac_signal'; AS_EXIT([1])' $ac_signal done ac_signal=0 diff --git a/autoconf.in b/autoconf.in index f1ca506b..08e5de87 100644 --- a/autoconf.in +++ b/autoconf.in @@ -237,7 +237,7 @@ done $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -252,7 +252,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit; + (exit 1); exit 1; } # Running m4. @@ -282,7 +282,7 @@ case $# in *) exec >&2 echo "$me: invalid number of arguments." echo "$help" - (exit 1); exit ;; + (exit 1); exit 1 ;; esac # Unless specified, the output is stdout. @@ -294,7 +294,7 @@ if test z$infile = z-; then cat >$infile elif test ! -r "$infile"; then echo "$me: $infile: No such file or directory" >&2 - (exit 1); exit + (exit 1); exit 1 fi # Output is produced into FD 4. Prepare it. @@ -316,7 +316,7 @@ case $task in : >$tmp/forbidden.rx : >$tmp/allowed.rx $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure || - { (exit 1); exit; } + { (exit 1); exit 1; } if test "x$outfile" != x-; then chmod +x $outfile @@ -429,7 +429,7 @@ EOF `$verbose "-v verbose=1"` \ -f "$tmp/finalize.awk" <$tmp/configure >&4 || { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 - (exit 1); exit; } + (exit 1); exit 1; } test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 ;; # End of the task script. @@ -691,16 +691,16 @@ EOF trace_opt="$trace_opt -t $base_name -t m4_$base_name" echo "$base_name$trace_format" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } echo "m4_$base_name$trace_format" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } else # MACRO_NAME is not a builtin. trace_opt="$trace_opt -t $macro_name" echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } fi echo >>$tmp/trace.m4 done @@ -740,7 +740,7 @@ EOF ' >&4 || { echo "$me: tracing failed" >&2 - (exit 1); exit + (exit 1); exit 1 } ;; @@ -750,7 +750,7 @@ EOF ## ------------ ## *) echo "$me: internal error: unknown task: $task" >&2 - (exit 1); exit + (exit 1); exit 1 esac -(exit $status); exit +(exit $status); exit $status diff --git a/autoheader.in b/autoheader.in index 1744a618..0babde46 100644 --- a/autoheader.in +++ b/autoheader.in @@ -181,7 +181,7 @@ done $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -196,7 +196,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit + (exit 1); exit 1 } # Preach. @@ -219,7 +219,7 @@ if ($warning_all || $warning_obsolete) && More sophisticated templates can also be produced, see the documentation. EOF - $warning_error && { (exit 1); exit; } + $warning_error && { (exit 1); exit 1; } fi acconfigs= @@ -237,13 +237,13 @@ case $# in *in ) infile=configure.in;; * ) echo "$me: no input file" >&2 - exit 1;; + (exit 1); exit 1;; esac;; 1) infile=$1 ;; *) exec >&2 echo "$me: invalid number of arguments." echo "$help" - (exit 1); exit ;; + (exit 1); exit 1;; esac # Set up autoconf. @@ -261,14 +261,14 @@ $autoconf \ --trace AH_OUTPUT:'ac_verbatim_$1="\ $2"' \ --trace AC_DEFINE_TRACE_LITERAL:'syms="$$syms $1"' \ - $infile >$tmp/traces.sh || { (exit 1); exit; } + $infile >$tmp/traces.sh || { (exit 1); exit 1; } $verbose $me: sourcing $tmp/traces.sh >&2 if (set -e && . $tmp/traces.sh) >/dev/null 2>&1; then . $tmp/traces.sh else echo "$me: error: shell error while sourcing $tmp/traces.sh" >&2 - (exit 1); exit + (exit 1); exit 1 fi @@ -290,7 +290,7 @@ config_h=`set X $config_h; echo $2` # Support "outfile[:infile]", defaulting infile="outfile.in". case "$config_h" in "") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2 - (exit 1); exit ;; + (exit 1); exit 1 ;; *:*) config_h_in=`echo "$config_h" | sed 's/.*://'` config_h=`echo "$config_h" | sed 's/:.*//'` ;; *) config_h_in="$config_h.in" ;; @@ -357,4 +357,4 @@ if test $status = 0; then fi fi -(exit $status); exit +(exit $status); exit $status diff --git a/autoreconf.in b/autoreconf.in index 809fc00d..19f3eab7 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -251,7 +251,7 @@ fi $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -266,7 +266,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit + (exit 1); exit 1 } # When debugging, it is convenient that all the related temporary diff --git a/bin/autoconf.in b/bin/autoconf.in index f1ca506b..08e5de87 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -237,7 +237,7 @@ done $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -252,7 +252,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit; + (exit 1); exit 1; } # Running m4. @@ -282,7 +282,7 @@ case $# in *) exec >&2 echo "$me: invalid number of arguments." echo "$help" - (exit 1); exit ;; + (exit 1); exit 1 ;; esac # Unless specified, the output is stdout. @@ -294,7 +294,7 @@ if test z$infile = z-; then cat >$infile elif test ! -r "$infile"; then echo "$me: $infile: No such file or directory" >&2 - (exit 1); exit + (exit 1); exit 1 fi # Output is produced into FD 4. Prepare it. @@ -316,7 +316,7 @@ case $task in : >$tmp/forbidden.rx : >$tmp/allowed.rx $run_m4f -Dm4_warnings=$m4_warnings $infile >$tmp/configure || - { (exit 1); exit; } + { (exit 1); exit 1; } if test "x$outfile" != x-; then chmod +x $outfile @@ -429,7 +429,7 @@ EOF `$verbose "-v verbose=1"` \ -f "$tmp/finalize.awk" <$tmp/configure >&4 || { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 - (exit 1); exit; } + (exit 1); exit 1; } test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 ;; # End of the task script. @@ -691,16 +691,16 @@ EOF trace_opt="$trace_opt -t $base_name -t m4_$base_name" echo "$base_name$trace_format" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } echo "m4_$base_name$trace_format" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } else # MACRO_NAME is not a builtin. trace_opt="$trace_opt -t $macro_name" echo "$trace" | $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || - { (exit 1); exit; } + { (exit 1); exit 1; } fi echo >>$tmp/trace.m4 done @@ -740,7 +740,7 @@ EOF ' >&4 || { echo "$me: tracing failed" >&2 - (exit 1); exit + (exit 1); exit 1 } ;; @@ -750,7 +750,7 @@ EOF ## ------------ ## *) echo "$me: internal error: unknown task: $task" >&2 - (exit 1); exit + (exit 1); exit 1 esac -(exit $status); exit +(exit $status); exit $status diff --git a/bin/autoheader.in b/bin/autoheader.in index 1744a618..0babde46 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -181,7 +181,7 @@ done $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -196,7 +196,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit + (exit 1); exit 1 } # Preach. @@ -219,7 +219,7 @@ if ($warning_all || $warning_obsolete) && More sophisticated templates can also be produced, see the documentation. EOF - $warning_error && { (exit 1); exit; } + $warning_error && { (exit 1); exit 1; } fi acconfigs= @@ -237,13 +237,13 @@ case $# in *in ) infile=configure.in;; * ) echo "$me: no input file" >&2 - exit 1;; + (exit 1); exit 1;; esac;; 1) infile=$1 ;; *) exec >&2 echo "$me: invalid number of arguments." echo "$help" - (exit 1); exit ;; + (exit 1); exit 1;; esac # Set up autoconf. @@ -261,14 +261,14 @@ $autoconf \ --trace AH_OUTPUT:'ac_verbatim_$1="\ $2"' \ --trace AC_DEFINE_TRACE_LITERAL:'syms="$$syms $1"' \ - $infile >$tmp/traces.sh || { (exit 1); exit; } + $infile >$tmp/traces.sh || { (exit 1); exit 1; } $verbose $me: sourcing $tmp/traces.sh >&2 if (set -e && . $tmp/traces.sh) >/dev/null 2>&1; then . $tmp/traces.sh else echo "$me: error: shell error while sourcing $tmp/traces.sh" >&2 - (exit 1); exit + (exit 1); exit 1 fi @@ -290,7 +290,7 @@ config_h=`set X $config_h; echo $2` # Support "outfile[:infile]", defaulting infile="outfile.in". case "$config_h" in "") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2 - (exit 1); exit ;; + (exit 1); exit 1 ;; *:*) config_h_in=`echo "$config_h" | sed 's/.*://'` config_h=`echo "$config_h" | sed 's/:.*//'` ;; *) config_h_in="$config_h.in" ;; @@ -357,4 +357,4 @@ if test $status = 0; then fi fi -(exit $status); exit +(exit $status); exit $status diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 809fc00d..19f3eab7 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -251,7 +251,7 @@ fi $debug || { trap 'status=$?; rm -rf $tmp && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 + trap '(exit 1); exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -266,7 +266,7 @@ $debug || } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - (exit 1); exit + (exit 1); exit 1 } # When debugging, it is convenient that all the related temporary diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 6897f116..94fd84a4 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1472,7 +1472,7 @@ trap 'exit_status=$? exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_status=$?; ac_signal='$ac_signal'; AS_EXIT([$ac_status])' $ac_signal + trap 'ac_signal='$ac_signal'; AS_EXIT([1])' $ac_signal done ac_signal=0 diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 8e4327a1..c3b94a11 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -479,7 +479,7 @@ m4_define([AS_TMPDIR], $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap 'AS_EXIT([$?])' 1 2 13 15 + trap 'AS_EXIT([1])' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. diff --git a/m4sh.m4 b/m4sh.m4 index 8e4327a1..c3b94a11 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -479,7 +479,7 @@ m4_define([AS_TMPDIR], $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap 'AS_EXIT([$?])' 1 2 13 15 + trap 'AS_EXIT([1])' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. diff --git a/tests/torture.at b/tests/torture.at index 8cca3260..8ca8a858 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -346,3 +346,21 @@ at_here=`pwd` AT_CHECK([cd at-dir && $at_here/configure], [], [ignore]) AT_CLEANUP(at-dir foo.in foo) + + +## ----------------- ## +## Signal handling. ## +## ----------------- ## + +AT_SETUP([Signal handling]) + +AT_DATA([configure.ac], +[[AC_INIT +kill -2 $$ +exit 77 +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], 1, ignore, ignore) + +AT_CLEANUP