changeset 16918:7d79512ede07

init.sh: do not rely on autoupated PWD This addresses symptoms of the problem reported by Nelson H.F. Beebe in <http://lists.gnu.org/archive/html/bug-gzip/2012-06/msg00008.html>. Although Nelson's bug was not necessarily fixed by this patch, it seems wise to make the change for safety. * tests/init.sh (path_prepend_): Do not rely on PWD updating automagically after 'cd'; this is not reliable on older shells. (setup_): Fail if we cannot cd to temporary directory.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 20 Jun 2012 07:06:54 -0700
parents d7028e1986c1
children 759e43f4cafc
files ChangeLog tests/init.sh
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-06-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+	init.sh: do not rely on autoupated PWD
+	This addresses symptoms of the problem reported by Nelson H.F. Beebe in
+	<http://lists.gnu.org/archive/html/bug-gzip/2012-06/msg00008.html>.
+	Although Nelson's bug was not necessarily fixed by this patch,
+	it seems wise to make the change for safety.
+	* tests/init.sh (path_prepend_): Do not rely on PWD updating
+	automagically after 'cd'; this is not reliable on older shells.
+	(setup_): Fail if we cannot cd to temporary directory.
+
 2012-06-19  Bruno Haible  <bruno@clisp.org>
 
 	stat, fstat: Avoid warnings on mingw64.
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -411,8 +411,7 @@
     case $path_dir_ in
       '') fail_ "invalid path dir: '$1'";;
       /*) abs_path_dir_=$path_dir_;;
-      *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \
-           || fail_ "invalid path dir: $path_dir_";;
+      *) abs_path_dir_=$initial_cwd_/$path_dir_;;
     esac
     case $abs_path_dir_ in
       *:*) fail_ "invalid path dir: '$abs_path_dir_'";;
@@ -448,7 +447,7 @@
   pfx_=`testdir_prefix_`
   test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \
     || fail_ "failed to create temporary directory in $initial_cwd_"
-  cd "$test_dir_"
+  cd "$test_dir_" || fail_ "failed to cd to temporary directory"
 
   # As autoconf-generated configure scripts do, ensure that IFS
   # is defined initially, so that saving and restoring $IFS works.