]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix some write failure cases in Autotest.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 16 Dec 2007 21:24:14 +0000 (22:24 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 16 Dec 2007 21:24:14 +0000 (22:24 +0100)
* lib/autotest/general.m4 (AT_INIT): Do not exit successfully
upon write failures for --help, --version, --list.
Guard against write failures for intermediate created scripts.
<at_func_create_debugging_script>: Do not make the debugging
script executable if it is not complete.

ChangeLog
lib/autotest/general.m4

index 323c135cac8af36d1fb0d95f7ca12f7fe1e0cb9f..412d0e578edccf7ca486e254f8cb497ec7b6a90c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix some write failure cases in Autotest.
+       * lib/autotest/general.m4 (AT_INIT): Do not exit successfully
+       upon write failures for --help, --version, --list.
+       Guard against write failures for intermediate created scripts.
+       <at_func_create_debugging_script>: Do not make the debugging
+       script executable if it is not complete.
+
 2007-12-12  Eric Blake  <ebb9@byu.net>
 
        Fix thinko in earlier patch - m4_join isn't defined yet.
index cf33cda5ada33ffadaec221499e0ed30430e11d4..11ff9255e8c0a7ba03ce2d1cc8e4f93a66878d8e 100644 (file)
@@ -327,14 +327,14 @@ at_func_test ()
 at_func_create_debugging_script ()
 {
   {
-    echo "#! /bin/sh"
+    echo "#! /bin/sh" &&
     echo 'test "${ZSH_VERSION+set}" = set dnl
-&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\'''
-    AS_ECHO(["cd '$at_dir'"])
+&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' &&
+    AS_ECHO(["cd '$at_dir'"]) &&
     AS_ECHO(["exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d ]dnl
-[$at_debug_args $at_group \${1+\"\$[@]\"}"])
+[$at_debug_args $at_group \${1+\"\$[@]\"}"]) &&
     echo 'exit 1'
-  } >"$at_group_dir/run"
+  } >"$at_group_dir/run" &&
   chmod +x "$at_group_dir/run"
 }
 
@@ -410,6 +410,8 @@ at_version_p=false
 at_list_p=false
 # Test groups to run
 at_groups=
+# Whether a write failure occurred
+at_write_fail=0
 
 # The directory we are in.
 at_dir=`pwd`
@@ -626,7 +628,7 @@ m4_divert_push([HELP])dnl
 
 # Help message.
 if $at_help_p; then
-  cat <<_ATEOF
+  cat <<_ATEOF || at_write_fail=1
 Usage: $[0] [[OPTION]... [VARIABLE=VALUE]... [TESTS]]
 
 Run all the tests, or the selected TESTS, given by numeric ranges, and
@@ -645,7 +647,7 @@ possibly amounts into
 _ATEOF
 m4_divert_pop([HELP])dnl
 m4_divert_push([HELP_MODES])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
 
 Operation modes:
   -h, --help     print the help message, then exit
@@ -655,7 +657,7 @@ Operation modes:
 _ATEOF
 m4_divert_pop([HELP_MODES])dnl
 m4_divert_push([HELP_TUNING])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
 
 dnl extra quoting prevents emacs whitespace mode from putting tabs in output
 Execution tuning:
@@ -671,16 +673,16 @@ Execution tuning:
 _ATEOF
 m4_divert_pop([HELP_TUNING])dnl
 m4_divert_push([HELP_END])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
 
 Report bugs to <AT_PACKAGE_BUGREPORT>.
 _ATEOF
-  exit 0
+  exit $at_write_fail
 fi
 
 # List of tests.
 if $at_list_p; then
-  cat <<_ATEOF
+  cat <<_ATEOF || at_write_fail=1
 AT_TESTSUITE_NAME test groups:
 
  NUM: FILE-NAME:LINE     TEST-GROUP-NAME
@@ -706,18 +708,18 @@ _ATEOF
             printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
             if ($ 4) printf "      %s\n", $ 4
           }
-        }'
-  exit 0
+        }' || at_write_fail=1
+  exit $at_write_fail
 fi
 m4_divert_pop([HELP_END])dnl
 m4_divert_push([VERSION])dnl
 if $at_version_p; then
-  AS_ECHO(["$as_me (AT_PACKAGE_STRING)"])
-  cat <<\_ACEOF
+  AS_ECHO(["$as_me (AT_PACKAGE_STRING)"]) &&
+  cat <<\_ACEOF || at_write_fail=1
 m4_divert_pop([VERSION])dnl
 m4_divert_push([VERSION_END])dnl
 _ACEOF
-  exit 0
+  exit $at_write_fail
 fi
 m4_divert_pop([VERSION_END])dnl
 m4_divert_push([PREPARE_TESTS])dnl
@@ -886,8 +888,9 @@ BEGIN { FS="\a" }
   test = substr ($ 0, 10)
   print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
   if (test == "'"$at_group"'") exit
-}' "$at_myself" > "$at_test_source"
-. "$at_test_source"
+}' "$at_myself" > "$at_test_source" &&
+. "$at_test_source" ||
+  AS_ERROR([cannot create test line number cache])
 
 
 m4_text_box([Driver loop.])