]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: don't misbehave if $TMPDIR contains spaces
authorPádraig Brady <P@draigBrady.com>
Sun, 30 Aug 2009 00:27:45 +0000 (01:27 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 30 Aug 2009 09:58:13 +0000 (10:58 +0100)
* tests/misc/xattr: Add quotes.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/leak-fd: Likewise.
* tests/mv/mv-special-1: Likewise.
* tests/mv/part-fail: Likewise.
* tests/mv/part-hardlink: Likewise.
* tests/mv/part-rename: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/partition-perm: Likewise.
* tests/mv/sticky-to-xpart: Likewise.

12 files changed:
tests/misc/xattr
tests/mv/acl
tests/mv/backup-is-src
tests/mv/hard-link-1
tests/mv/leak-fd
tests/mv/mv-special-1
tests/mv/part-fail
tests/mv/part-hardlink
tests/mv/part-rename
tests/mv/part-symlink
tests/mv/partition-perm
tests/mv/sticky-to-xpart

index f067ff5357c9a0c9bc4ce9933ca327a57e9aa565..a27e1f6d9e3ead76adf311e94e97e7848d919d96 100755 (executable)
@@ -36,7 +36,7 @@ cp --preserve=xattr -n src dest 2>/dev/null \
 cleanup_() { rm -rf "$other_partition_tmpdir"; }
 . "$abs_srcdir/other-fs-tmpdir"
 b_other="$other_partition_tmpdir/b"
-rm -f $b_other || framework_failure
+rm -f "$b_other" || framework_failure
 
 # testing xattr name-value pair
 xattr_name="user.foo"
@@ -98,17 +98,18 @@ EOF
 
 # try to set user xattr on file on other partition
 test_mv=1
-touch $b_other || framework_failure
-setfattr -n "$xattr_name" -v "$xattr_value" $b_other >out_a 2>/dev/null \
+touch "$b_other" || framework_failure
+setfattr -n "$xattr_name" -v "$xattr_value" "$b_other" >out_a 2>/dev/null \
   || test_mv=0
-getfattr -d $b_other >out_b 2>/dev/null || test_mv=0
+getfattr -d "$b_other" >out_b 2>/dev/null || test_mv=0
 grep -F "$xattr_pair" out_b >/dev/null || test_mv=0
-rm -f $b_other || framework_failure
+rm -f "$b_other" || framework_failure
 
 if test $test_mv -eq 1; then
   # mv should preserve xattr when copying content from one partition to another
-  mv b $b_other || fail=1
-  getfattr -d $b_other >out_b 2>/dev/null || skip_test_ "failed to get xattr of file"
+  mv b "$b_other" || fail=1
+  getfattr -d "$b_other" >out_b 2>/dev/null ||
+    skip_test_ "failed to get xattr of file"
   grep -F "$xattr_pair" out_b >/dev/null || fail=1
 else
   cat >&2 <<EOF
index e4e31dd1dfe799cfaf64ae104ff9cffefd2be138..5ad8de05210d6b4e1966a2c0c547e373610bfc5c 100755 (executable)
@@ -49,24 +49,24 @@ test $skip_partition != none &&
   skip_test_ "'$skip' is not on a suitable file system for this test"
 
 # move the access acl of a file
-mv file $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl file` || framework_failure
+mv file "$other_partition_tmpdir" || fail=1
+acl2=`cd "$other_partition_tmpdir" && getfacl file` || framework_failure
 test "$acl1" = "$acl2" || fail=1
 
 # move the access acl of a directory
 mkdir dir || framework_failure
 setfacl -m user:bin:rw dir || framework_failure
 acl1=`getfacl dir` || framework_failure
-mv dir $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir` || framework_failure
+mv dir "$other_partition_tmpdir" || fail=1
+acl2=`cd "$other_partition_tmpdir" && getfacl dir` || framework_failure
 test "$acl1" = "$acl2" || fail=1
 
 # move the default acl of a directory
 mkdir dir2 || framework_failure
 setfacl -d -m user:bin:rw dir2 || framework_failure
 acl1=`getfacl dir2` || framework_failure
-mv dir2 $other_partition_tmpdir || fail=1
-acl2=`cd $other_partition_tmpdir && getfacl dir2` || framework_failure
+mv dir2 "$other_partition_tmpdir" || fail=1
+acl2=`cd "$other_partition_tmpdir" && getfacl dir2` || framework_failure
 test "$acl1" = "$acl2" || fail=1
 
 Exit $fail
index 506c14909e87718b5757c5ce8bd2abad57d5dd43..df6561bafa8ec2395ba0136f45178e3b35ab3c12 100755 (executable)
@@ -28,12 +28,12 @@ cleanup_() { rm -rf "$other_partition_tmpdir"; }
 a="$other_partition_tmpdir/a"
 a2="$other_partition_tmpdir/a~"
 
-rm -f $a $a2 || framework_failure
-echo a > $a || framework_failure
-echo a2 > $a2 || framework_failure
+rm -f "$a" "$a2" || framework_failure
+echo a > "$a" || framework_failure
+echo a2 > "$a2" || framework_failure
 
 # This mv command should exit nonzero.
-mv --b=simple $a2 $a > out 2>&1 && fail=1
+mv --b=simple "$a2" "$a" > out 2>&1 && fail=1
 
 sed \
    -e "s,mv:,XXX:," \
index 7bcc0493a711b0c753516d21124aabd842e1220d..2df2cf3ff9de051ca8a0fd0264b13f1bdf91d8b0 100755 (executable)
@@ -32,10 +32,10 @@ mkdir $dir || framework_failure
 > $dir/a || framework_failure
 ln $dir/a $dir/b || framework_failure
 
-mv $dir $other_partition_tmpdir || fail=1
+mv $dir "$other_partition_tmpdir" || fail=1
 
 # Display inode numbers, one per line.
-ls -1i $other_partition_tmpdir/$dir > out || fail=1
+ls -1i "$other_partition_tmpdir/$dir" > out || fail=1
 
 # Make sure the inode numbers are the same.
 a=`sed -n 's/ a$//p' out`
index 55a4e3a810043bd69a93afaa9cafedeee94def13..76a6b439a8ac360b473fcd4fc1d8390ec67ea92b 100755 (executable)
@@ -50,7 +50,7 @@ test -f $last_file || framework_failure
 
 fail=0
 
-mv * $other_partition_tmpdir || fail=1
+mv * "$other_partition_tmpdir" || fail=1
 test -f $last_file/f && fail=1
 rm .dirs
 
index 208bc7f910796d5d086d3e9c9f89af27fb8289c1..321c54e64f9cad4aaa1b2fc4169f1f55e4a7889d 100755 (executable)
@@ -42,13 +42,13 @@ touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure
 # It's not worth making an exception any more.
 
 fail=0
-mv --verbose $null $dir $other_partition_tmpdir > out || fail=1
+mv --verbose $null $dir "$other_partition_tmpdir" > out || fail=1
 # Make sure the files are gone.
 test -p $null && fail=1
 test -d $dir && fail=1
 # Make sure they were moved.
-test -p $other_partition_tmpdir/$null || fail=1
-test -d $other_partition_tmpdir/$dir/a/b/c || fail=1
+test -p "$other_partition_tmpdir/$null" || fail=1
+test -d "$other_partition_tmpdir/$dir/a/b/c" || fail=1
 
 # POSIX says rename (A, B) can succeed if A and B are on different file systems,
 # so ignore chatter about when files are removed and copied rather than renamed.
@@ -72,7 +72,7 @@ EOF
 
 compare out2 exp || fail=1
 
-# cd $other_partition_tmpdir
-# ls -l -A -R $other_partition_tmpdir
+# cd "$other_partition_tmpdir"
+# ls -l -A -R "$other_partition_tmpdir"
 
 Exit $fail
index b1048e9656c957aa51fdedaedad0888bd44231c9..290864dff8a1bc35c2cb0f674dd6717fb742ba56 100755 (executable)
@@ -29,12 +29,12 @@ skip_if_root_
 cleanup_() { t=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; }
 . "$abs_srcdir/other-fs-tmpdir"
 
-touch k $other_partition_tmpdir/k || framework_failure
-chmod u-w $other_partition_tmpdir || framework_failure
+touch k "$other_partition_tmpdir/k" || framework_failure
+chmod u-w "$other_partition_tmpdir" || framework_failure
 
 fail=0
 
-mv -f k $other_partition_tmpdir 2> out && fail=1
+mv -f k "$other_partition_tmpdir" 2> out && fail=1
 cat <<EOF > exp
 mv: inter-device move failed: \`k' to \`$other_partition_tmpdir/k'; unable to remove target: Permission denied
 EOF
index 32d58d71574ac98187dcd166280eb57b3d2d5e55..51dea204363964021ccdc11192923b724220e614 100755 (executable)
@@ -36,10 +36,10 @@ ln a/1 b/1 || framework_failure
 
 fail=0
 
-mv f g $other_partition_tmpdir || fail=1
-mv a b $other_partition_tmpdir || fail=1
+mv f g "$other_partition_tmpdir" || fail=1
+mv a b "$other_partition_tmpdir" || fail=1
 
-cd $other_partition_tmpdir
+cd "$other_partition_tmpdir"
 set `ls -Ci f g`
 test $1 = $3 || fail=1
 set `ls -Ci a/1 b/1`
index 0337220436b4a92638562f1494cbbe604f2ddbf4..45b8615ecdcf5864dbc2b02c50820106c00e0ac7 100755 (executable)
@@ -31,6 +31,6 @@ mkdir foo || framework_failure
 
 fail=0
 
-mv foo/ $other_partition_tmpdir/bar || fail=1
+mv foo/ "$other_partition_tmpdir/bar" || fail=1
 
 Exit $fail
index 71788b9056866a70ac543543b16914271dc921dc..a12a9f531e91bd165391ade81fd460a2d356a06d 100755 (executable)
@@ -69,7 +69,7 @@ for copy in cp mv; do
     for options in '' --rem '--rem -d' '--rem -b' -b -bd -d; do
       case "$options" in *d*|*--rem*) test $copy = mv && continue;; esac
       rm -rf dir || fail=1
-      rm -f $other_partition_tmpdir/* || fail=1
+      rm -f "$other_partition_tmpdir"/* || fail=1
       mkdir dir || fail=1
       cd dir || fail=1
       case "$args" in *loc_reg*) reg_abs="`pwd`/$loc_reg" ;; esac
@@ -94,7 +94,7 @@ for copy in cp mv; do
           # and put brackets around the output.
           test -s .err && {
             echo '[' | tr -d '\n'
-            sed 's/^[^:][^:]*\(..\):/\1:/;s,'$other_partition_tmpdir/,, .err
+            sed 's/^[^:][^:]*\(..\):/\1:/;s,'"$other_partition_tmpdir/,," .err
             echo ']' | tr -d '\n'
             }
           # Strip off all but the file names.
@@ -102,13 +102,13 @@ for copy in cp mv; do
           ls=`ls -gG --ignore=.err . \
               | sed \
                   -e '/^total /d' \
-                  -e s,$other_partition_tmpdir/,, \
+                  -e "s,$other_partition_tmpdir/,," \
                   -e "s,$pwd_tmp/,," \
                   -e 's/^[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *//'`
-          ls2=`cd $other_partition_tmpdir && ls -gG --ignore=.err . \
+          ls2=`cd "$other_partition_tmpdir" && ls -gG --ignore=.err . \
               | sed \
                   -e '/^total /d' \
-                  -e s,$other_partition_tmpdir/,, \
+                  -e "s,$other_partition_tmpdir/,," \
                   -e "s,$pwd_tmp/,," \
                   -e 's/^[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *[^ ]*  *//'`
           echo "($ls) ($ls2)"
index ee7d6a9a285531fa616c23358550dd1721cdeebd..41a193cc2c150be55a5c518297d7bc3a1a02cfbc 100755 (executable)
@@ -29,14 +29,14 @@ cleanup_() { rm -rf "$other_partition_tmpdir"; }
 chmod a=rwx file
 
 umask 077
-mv file $other_partition_tmpdir
+mv file "$other_partition_tmpdir"
 
 fail=0
 test -f file && fail=1
-test -f $other_partition_tmpdir/file || fail=1
+test -f "$other_partition_tmpdir/file" || fail=1
 
 # This would have failed with the mv from fileutils-4.0i.
-mode=`ls -l $other_partition_tmpdir/file|cut -b-10`
+mode=`ls -l "$other_partition_tmpdir/file" | cut -b-10`
 test "$mode" = "-rwxrwxrwx" || fail=1
 
 Exit $fail
index a4ab3dd21d4d34e53ab841380fa13549139b4b4a..f0f9f95e34e0aa373af5d4bcd2cd381a7237cb46 100755 (executable)
@@ -52,7 +52,7 @@ case $version in
 esac
 
 setuidgid $NON_ROOT_USERNAME env PATH="$PATH" \
-  mv t/root-owned $other_partition_tmpdir 2> out-t && fail=1
+  mv t/root-owned "$other_partition_tmpdir" 2> out-t && fail=1
 
 # On some systems, we get `Not owner'.  Convert it.
 # On other systems (HPUX), we get `Permission denied'.  Convert it, too.