]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Add a test to verify that we get the new
authorJim Meyering <jim@meyering.net>
Mon, 28 Jun 2004 18:47:24 +0000 (18:47 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 28 Jun 2004 18:47:24 +0000 (18:47 +0000)
diagnostic when failing to copy through a symlink-to-inaccessible-dir.

tests/cp/fail-perm

index c2b18801b20a50b6e525986999fb9c8d6345348e..218785a9f86c1aa4621be0a2d85295d82452175a 100755 (executable)
@@ -16,7 +16,7 @@ framework_failure=0
 mkdir -p $tmp || framework_failure=1
 cd $tmp || framework_failure=1
 
-mkdir D || framework_failure=1
+mkdir D D/D || framework_failure=1
 touch D/a || framework_failure=1
 chmod 0 D/a || framework_failure=1
 chmod 500 D || framework_failure=1
@@ -36,6 +36,20 @@ cp -pR D DD > /dev/null 2>&1 && fail=1
 set X `ls -ld DD`
 shift
 test "$1" = dr-x------ || fail=1
+
+chmod 0 D
+ln -s D/D symlink
+touch F
+cat > exp <<\EOF
+cp: accessing `symlink': Permission denied
+EOF
+
+cp F symlink 2> out && fail=1
+cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
+
+cp --target-directory=symlink F 2> out && fail=1
+cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
+
 chmod 700 D
 
 (exit $fail); exit $fail