Annotation of embedaddon/rsync/testsuite/chmod-option.test, revision 1.1
1.1 ! misho 1: #! /bin/sh
! 2:
! 3: # Copyright (C) 2002 by Martin Pool <mbp@samba.org>
! 4:
! 5: # This program is distributable under the terms of the GNU GPL (see
! 6: # COPYING).
! 7:
! 8: # Test that the --chmod option functions correctly.
! 9:
! 10: . $srcdir/testsuite/rsync.fns
! 11:
! 12: # Build some files
! 13:
! 14: fromdir="$scratchdir/from"
! 15: todir="$scratchdir/to"
! 16: checkdir="$scratchdir/check"
! 17:
! 18: mkdir "$fromdir"
! 19: name1="$fromdir/name1"
! 20: name2="$fromdir/name2"
! 21: dir1="$fromdir/dir1"
! 22: dir2="$fromdir/dir2"
! 23: echo "This is the file" > "$name1"
! 24: echo "This is the other file" > "$name2"
! 25: mkdir "$dir1" "$dir2"
! 26:
! 27: chmod 4700 "$name1" || test_skipped "Can't chmod"
! 28: chmod 700 "$dir1"
! 29: chmod 770 "$dir2"
! 30:
! 31: # Copy the files we've created over to another directory
! 32: checkit "$RSYNC -avv '$fromdir/' '$checkdir/'" "$fromdir" "$checkdir"
! 33:
! 34: # And then manually make the changes which should occur
! 35: umask 002
! 36: chmod ug-s,a+rX "$checkdir"/*
! 37: chmod +w "$checkdir" "$checkdir"/dir*
! 38:
! 39: checkit "$RSYNC -avv --chmod ug-s,a+rX,D+w '$fromdir/' '$todir/'" "$checkdir" "$todir"
! 40:
! 41: rm -r "$fromdir" "$checkdir" "$todir"
! 42: makepath "$todir" "$fromdir/foo"
! 43: touch "$fromdir/bar"
! 44:
! 45: checkit "$RSYNC -avv '$fromdir/' '$checkdir/'" "$fromdir" "$checkdir"
! 46: chmod o+x "$fromdir"/bar
! 47:
! 48: checkit "$RSYNC -avv --chmod=Fo-x '$fromdir/' '$todir/'" "$checkdir" "$todir"
! 49:
! 50: # Tickle a bug in rsync 2.6.8: if you push a new directory with --perms off to
! 51: # a daemon with an incoming chmod, the daemon pretends the directory is a file
! 52: # for the purposes of the second application of the incoming chmod.
! 53:
! 54: build_rsyncd_conf
! 55: cat >>"$scratchdir/test-rsyncd.conf" <<EOF
! 56: [test-incoming-chmod]
! 57: path = $todir
! 58: read only = no
! 59: incoming chmod = Fo-x
! 60: EOF
! 61:
! 62: RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"
! 63: export RSYNC_CONNECT_PROG
! 64:
! 65: rm -r "$todir"
! 66: makepath "$todir"
! 67:
! 68: checkit "$RSYNC -avv --no-perms '$fromdir/' localhost::test-incoming-chmod/" "$checkdir" "$todir"
! 69:
! 70: # The script would have aborted on error, so getting here means we've won.
! 71: exit 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>