]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
*** empty log message ***
authorJim Meyering <jim@meyering.net>
Sat, 12 Aug 2000 07:24:27 +0000 (07:24 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 12 Aug 2000 07:24:27 +0000 (07:24 +0000)
tests/cp/perm [new file with mode: 0755]

diff --git a/tests/cp/perm b/tests/cp/perm
new file mode 100755 (executable)
index 0000000..b87c8fa
--- /dev/null
@@ -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