mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 11:16:16 +02:00
*** empty log message ***
This commit is contained in:
44
tests/cp/perm
Executable file
44
tests/cp/perm
Executable file
@@ -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
|
||||
Reference in New Issue
Block a user