From 2d5707c7479eacb3b1ad98e01b53f56a88f8fb78 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 18:14:31 +0200 Subject: Adding upstream version 3.2.7. Signed-off-by: Daniel Baumann --- testsuite/dir-sgid.test | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 testsuite/dir-sgid.test (limited to 'testsuite/dir-sgid.test') diff --git a/testsuite/dir-sgid.test b/testsuite/dir-sgid.test new file mode 100644 index 0000000..d6b9a3c --- /dev/null +++ b/testsuite/dir-sgid.test @@ -0,0 +1,48 @@ +#!/bin/sh + +# This program is distributable under the terms of the GNU GPL (see +# COPYING). + +# Test that rsync obeys directory setgid. -- Matt McCutchen + +. $suitedir/rsync.fns + +umask 077 + +# Call as: testit +testit() { + todir="$scratchdir/$1" + mkdir "$todir" + chmod $2 "$todir" + # Make sure we obey directory setgid when creating a directory to hold multiple transferred files, + # even though the directory itself is outside the transfer + $RSYNC -rvv "$scratchdir/dir" "$scratchdir/file" "$scratchdir/program" "$todir/to/" + check_perms "$todir/to" $5 "Target $1" + check_perms "$todir/to/dir" $5 "Target $1" + check_perms "$todir/to/file" $3 "Target $1" + check_perms "$todir/to/program" $4 "Target $1" +} + +mkdir "$scratchdir/dir" +# Cygwin has a persistent default dir ACL that ruins this test. +case `getfacl "$scratchdir/dir" 2>/dev/null || true` in +*default:user::*) test_skipped "The default ACL mode interferes with this test" ;; +esac + +echo "File!" >"$scratchdir/file" +echo "#!/bin/sh" >"$scratchdir/program" + +chmod u=rwx,g=rw,g+s,o=r "$scratchdir/dir" || test_skipped "Can't chmod" +chmod 664 "$scratchdir/file" +chmod 775 "$scratchdir/program" + +[ -g "$scratchdir/dir" ] || test_skipped "The directory setgid bit vanished!" +mkdir "$scratchdir/dir/blah" +[ -g "$scratchdir/dir/blah" ] || test_skipped "Your filesystem doesn't use directory setgid; maybe it's BSD." + +# Test some target directories +testit setgid-off 700 rw------- rwx------ rwx------ +testit setgid-on u=rwx,g=rw,g+s,o-rwx rw------- rwx------ rwx--S--- + +# Hooray +exit 0 -- cgit v1.2.3