unigbrk: New modules for grapheme clusters.
[pspp] / tests / init.sh
index d655fbbb60fbf4355dd8b2d693e26174f3dbc019..e537b6c6739a665d028c8d91fed67d36fafc073c 100644 (file)
@@ -111,7 +111,7 @@ fi
 
 # Eval this code in a subshell to determine a shell's suitability.
 # 10 - passes all tests; ok to use
-#  9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score
+#  9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score
 #  ? - not ok
 gl_shell_test_script_='
 test $(echo y) = y || exit 1
@@ -240,9 +240,14 @@ find_exe_basenames_()
   feb_result_=
   feb_sp_=
   for feb_file_ in $feb_dir_/*.exe; do
-    if test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_"; then
-      return 0
-    fi
+    # If there was no *.exe file, or there existed a file named "*.exe" that
+    # was deleted between the above glob expansion and the existence test
+    # below, just skip it.
+    test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+      && continue
+    # Exempt [.exe, since we can't create a function by that name, yet
+    # we can't invoke [ by PATH search anyways due to shell builtins.
+    test "x$feb_file_" = "x$feb_dir_/[.exe" && continue
     case $feb_file_ in
       *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
       *) # Remove leading file name components as well as the .exe suffix.
@@ -260,7 +265,7 @@ find_exe_basenames_()
 # For each file name of the form PROG.exe, create an alias named
 # PROG that simply invokes PROG.exe, then return 0.  If any selected
 # file name or the directory name, $1, contains an unexpected character,
-# define no function and return 1.
+# define no alias and return 1.
 create_exe_shims_()
 {
   case $EXEEXT in
@@ -270,7 +275,7 @@ create_exe_shims_()
   esac
 
   base_names_=`find_exe_basenames_ $1` \
-    || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; }
+    || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; }
 
   if test -n "$base_names_"; then
     for base_ in $base_names_; do
@@ -322,12 +327,19 @@ setup_()
   fi
 
   initial_cwd_=$PWD
+  fail=0
 
   pfx_=`testdir_prefix_`
   test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
     || fail_ "failed to create temporary directory in $initial_cwd_"
   cd "$test_dir_"
 
+  # As autoconf-generated configure scripts do, ensure that IFS
+  # is defined initially, so that saving and restoring $IFS works.
+  gl_init_sh_nl_='
+'
+  IFS=" ""     $gl_init_sh_nl_"
+
   # This trap statement, along with a trap on 0 below, ensure that the
   # temporary directory, $test_dir_, is removed upon exit as well as
   # upon receipt of any of the listed signals.
@@ -405,11 +417,10 @@ mktempd_()
 
   case $template_ in
   *XXXX) ;;
-  *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";;
+  *) fail_ \
+       "invalid template: $template_ (must have a suffix of at least 4 X's)";;
   esac
 
-  fail=0
-
   # First, try to use mktemp.
   d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \
     || fail=1