From f2893678eb5ca198a29db41d59ad8bc81b1c692e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 12 Aug 2000 07:24:27 +0000 Subject: *** empty log message *** --- tests/cp/perm | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tests/cp/perm (limited to 'tests') 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 -- cgit v1.2.3-70-g09d2