2 # Make sure the permission-preserving code in copy.c (mv, cp, install) works.
6 if test "$VERBOSE" = yes; then
12 .
$srcdir/..
/envvar-check
15 t0
=`echo "$0"|sed 's,.*/,,'`.tmp
;tmp
=$t0/$$
16 trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
17 trap '(exit $?); exit' 1 2 13 15
20 mkdir
-p $tmp || framework_failure
=1
21 cd $tmp || framework_failure
=1
25 if test $framework_failure = 1; then
26 echo 'failure in testing framework'
32 # Now, try it with `mv', with combinations of --force, no-f and
33 # existing-destination and not.
37 for cmd
in mv 'cp -p' cp; do
38 for force
in '' -f; do
39 for existing_dest
in yes no
; do
40 for g_perm
in r w x rw wx xr rwx
; do
41 for o_perm
in r w x rw wx xr rwx
; do
43 chmod u
=r
,g
=rx
,o
= src ||
exit 1
48 test $existing_dest = yes && {
50 chmod u
=rw
,g
=$g_perm,o
=$o_perm dest ||
exit 1
52 $cmd $force src dest ||
exit 1
53 test "$cmd" = mv && test -f src
&& exit 1
54 test "$cmd" = cp && { test -f src ||
exit 1; }
58 case "$cmd:$force:$existing_dest" in
60 _g_perm
=`echo rwx|sed 's/[^'$g_perm']/-/g'`
61 _o_perm
=`echo rwx|sed 's/[^'$o_perm']/-/g'`
62 expected_perms
=-rw-$_g_perm$_o_perm
66 expected_perms
=`echo $expected_perms|sed 's/.....$/-----/'`
68 expected_perms
=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'`
71 test _
$1 = _
$expected_perms ||
exit 1
72 # Perform only one iteration when there's no existing destination.
73 test $existing_dest = no
&& break 3
81 (exit $fail); exit $fail