Changed some instances of \" in checkit calls to '.
[rsync/rsync.git] / testsuite / dir-sgid.test
CommitLineData
b31243b4
WD
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
8. $srcdir/testsuite/rsync.fns
9
10umask 077
11
12# Call as: testit <dirname> <dirperms> <file-expected> <program-expected> <dir-expected>
13testit() {
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
26echo "File!" >"$scratchdir/file"
27echo "#!/bin/sh" >"$scratchdir/program"
28mkdir "$scratchdir/dir"
29chmod 2764 "$scratchdir/dir" || test_skipped "Can't chmod"
30chmod 664 "$scratchdir/file"
31chmod 775 "$scratchdir/program"
32[ -g "$scratchdir/dir" ] || test_skipped "The directory setgid bit vanished!"
33mkdir "$scratchdir/dir/blah"
34[ -g "$scratchdir/dir/blah" ] || test_skipped "Your filesystem doesn't use directory setgid; maybe it's BSD."
35
36# Test some target directories
37testit setgid-off 700 rw------- rwx------ rwx------
38testit setgid-on 2700 rw------- rwx------ rwx--S---
39
40# Hooray
41exit 0