diff options
Diffstat (limited to 'tests/cp')
-rwxr-xr-x | tests/cp/special-bits | 33 |
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 |