summaryrefslogtreecommitdiff
path: root/tests/cp/special-bits
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-09-09 08:18:10 +0000
committerJim Meyering <jim@meyering.net>2000-09-09 08:18:10 +0000
commitf6c0c0ee16b5ebe8a74e288893995bf5995f3edd (patch)
treea29e8ecf4f4c4bc85e3bfd06f25348087041f997 /tests/cp/special-bits
parentbb4904c751205c41ffd729d4263dcac609800335 (diff)
downloadcoreutils-f6c0c0ee16b5ebe8a74e288893995bf5995f3edd.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/cp/special-bits')
-rwxr-xr-xtests/cp/special-bits33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cp/special-bits b/tests/cp/special-bits
new file mode 100755
index 000000000..7658b098d
--- /dev/null
+++ b/tests/cp/special-bits
@@ -0,0 +1,33 @@
+#!/bin/sh
+# make sure `cp -p' preserves special bits
+# This works only when run as root.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ cp --version
+fi
+
+pwd=`pwd`
+tmp=spec-bits.$$
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
+
+framework_failure=0
+mkdir $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+
+touch a b || framework_failure=1
+chmod u+sx,go= a || framework_failure=1
+chmod u=rwx,g=sx,o= b || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+fail=0
+
+cp -p a a2 || fail=1
+cp -p b b2 || fail=1
+
+(exit $fail); exit