* 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.
This commit is contained in:
Pavel Roskin 2001-06-02 05:49:54 +00:00
parent 2a144793ef
commit 8dba4e28ab
12 changed files with 78 additions and 50 deletions

View File

@ -1,3 +1,13 @@
2001-06-02 Pavel Roskin <proski@gnu.org>
* 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 <akim@epita.fr>
* m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Clarify the error

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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