summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-08-12 07:24:27 +0000
committerJim Meyering <jim@meyering.net>2000-08-12 07:24:27 +0000
commitf2893678eb5ca198a29db41d59ad8bc81b1c692e (patch)
tree06421738741ee150b8166c7875ee087d8534f3f0
parent1a27d413521010f6ee19a4185237c752ef0283ee (diff)
downloadcoreutils-f2893678eb5ca198a29db41d59ad8bc81b1c692e.tar.xz
*** empty log message ***
-rwxr-xr-xtests/cp/perm44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/cp/perm b/tests/cp/perm
new file mode 100755
index 000000000..b87c8fa5a
--- /dev/null
+++ b/tests/cp/perm
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Make sure the permission-preserving code in copy.c (mv, cp, install) works.
+
+pwd=`pwd`
+tmp=perm.$$
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap 'exit $?' 1 2 13 15
+
+framework_failure=0
+mkdir $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+touch f || framework_failure=1
+chmod u=r,go= f || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+fail=0
+
+cp -p f f2 || fail=1
+
+# Permissions on f2 must be `-r--------'
+
+set X `ls -l f2`
+shift
+test "$1" = -r-------- || fail=1
+chmod u+w,g=rwx f2 || fail=1
+
+# Again, but with an existing target.
+cp -p f f2 || fail=1
+set X `ls -l f2`
+shift
+test "$1" = -r-------- || fail=1
+
+# Again, but with an existing target, and this time with `-f'.
+cp -p -f f f2 || fail=1
+set X `ls -l f2`
+shift
+test "$1" = -r-------- || fail=1
+
+(exit $fail); exit