summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-01-11 15:10:02 +0100
committerJim Meyering <meyering@redhat.com>2008-01-31 10:06:06 +0100
commit49d22be1a66b86c57c854946f85c86fa439908f9 (patch)
treef1189b60aa751de469027e1d2dd8c26462a108e6
parente8bb94a4e3490ec3ec3e8bacba3f0b195e9d4a5e (diff)
downloadcoreutils-49d22be1a66b86c57c854946f85c86fa439908f9.tar.xz
Improve the cp/parent-perm test.
* tests/cp/parent-perm: Also check that perms of existing dest dirs are changed to match those of corresponding src dir
-rw-r--r--ChangeLog6
-rwxr-xr-xtests/cp/parent-perm12
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8788843bf..205ef07f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-31 Jim Meyering <meyering@redhat.com>
+
+ Improve the cp/parent-perm test.
+ * tests/cp/parent-perm: Also check that perms of existing dest
+ dirs are changed to match those of corresponding src dir
+
2008-01-30 Paul Eggert <eggert@cs.ucla.edu>
Don't modify argv in dd due to ',' in arguments.
diff --git a/tests/cp/parent-perm b/tests/cp/parent-perm
index cedcac4df..1e9e8e1ea 100755
--- a/tests/cp/parent-perm
+++ b/tests/cp/parent-perm
@@ -24,10 +24,17 @@ fi
. $srcdir/../envvar-check
. $srcdir/../test-lib.sh
+. $abs_srcdir/../umask-check
+
mkdir -p a/b/c a/b/d e || framework_failure
touch a/b/c/foo a/b/d/foo || framework_failure
cp -p --parent a/b/c/foo e || framework_failure
+# Make permissions of e/a different, so that we exercise the
+# code in cp -p --parents that propagates permissions even
+# to a destination directory that it doesn't create.
+chmod g-rx e/a e/a/b || framework_failure
+
fail=0
cp -p --parent a/b/d/foo e || fail=1
@@ -41,7 +48,10 @@ cp -p --parent a/b/d/foo e || fail=1
# so "a/" inherits that. However, when the user does not belong to
# the group of the build directory, chmod ("a/e", 02755) returns 0,
# yet fails to set the S_ISGID bit.
-test $(stat --printf %A a|sed s/s/x/g) = $(stat --printf %A e/a|sed s/s/x/g) ||
+for dir in a a/b a/b/d; do
+ test $(stat --printf %A $dir|sed s/s/x/g) \
+ = $(stat --printf %A e/$dir|sed s/s/x/g) ||
fail=1
+done
(exit $fail); exit $fail