Annotation of embedaddon/rsync/testsuite/dir-sgid.test, revision 1.1.1.3
1.1 misho 1: #! /bin/sh
2:
3: # This program is distributable under the terms of the GNU GPL (see
4: # COPYING).
5:
6: # Test that rsync obeys directory setgid. -- Matt McCutchen
7:
1.1.1.2 misho 8: . $suitedir/rsync.fns
1.1 misho 9:
10: umask 077
11:
12: # Call as: testit <dirname> <dirperms> <file-expected> <program-expected> <dir-expected>
13: testit() {
14: todir="$scratchdir/$1"
15: mkdir "$todir"
16: chmod $2 "$todir"
17: # Make sure we obey directory setgid when creating a directory to hold multiple transferred files,
18: # even though the directory itself is outside the transfer
19: $RSYNC -rvv "$scratchdir/dir" "$scratchdir/file" "$scratchdir/program" "$todir/to/"
20: check_perms "$todir/to" $5 "Target $1"
21: check_perms "$todir/to/dir" $5 "Target $1"
22: check_perms "$todir/to/file" $3 "Target $1"
23: check_perms "$todir/to/program" $4 "Target $1"
24: }
25:
1.1.1.3 ! misho 26: mkdir "$scratchdir/dir"
! 27: # Cygwin has a persistent default dir ACL that ruins this test.
! 28: case `getfacl "$scratchdir/dir" 2>/dev/null || true` in
! 29: *default:user::*) test_skipped "The default ACL mode interferes with this test" ;;
! 30: esac
! 31:
1.1 misho 32: echo "File!" >"$scratchdir/file"
33: echo "#!/bin/sh" >"$scratchdir/program"
1.1.1.3 ! misho 34:
1.1.1.2 misho 35: chmod u=rwx,g=rw,g+s,o=r "$scratchdir/dir" || test_skipped "Can't chmod"
1.1 misho 36: chmod 664 "$scratchdir/file"
37: chmod 775 "$scratchdir/program"
1.1.1.3 ! misho 38:
1.1 misho 39: [ -g "$scratchdir/dir" ] || test_skipped "The directory setgid bit vanished!"
40: mkdir "$scratchdir/dir/blah"
41: [ -g "$scratchdir/dir/blah" ] || test_skipped "Your filesystem doesn't use directory setgid; maybe it's BSD."
42:
43: # Test some target directories
44: testit setgid-off 700 rw------- rwx------ rwx------
1.1.1.2 misho 45: testit setgid-on u=rwx,g=rw,g+s,o-rwx rw------- rwx------ rwx--S---
1.1 misho 46:
47: # Hooray
48: exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>