chmod-temp-dir.test 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /bin/sh
  2. # Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
  3. # This program is distributable under the terms of the GNU GPL (see
  4. # COPYING).
  5. # Test that various read-only and set[ug]id permissions work properly,
  6. # even when using a --temp-dir option (which we try to point at a
  7. # different filesystem than the destination dir).
  8. . "$suitedir/rsync.fns"
  9. hands_setup
  10. tmpdir2=/tmp
  11. sdev=`$TOOLDIR/getfsdev $scratchdir`
  12. tdev=`$TOOLDIR/getfsdev $tmpdir2`
  13. if [ x$sdev = x$tdev ]; then
  14. tmpdir2=/var/tmp
  15. tdev=`$TOOLDIR/getfsdev $tmpdir2`
  16. [ x$sdev = x$tdev ] && test_skipped "Can't find a tmp dir on a different file system"
  17. fi
  18. chmod 440 "$fromdir/text"
  19. chmod 500 "$fromdir/dir/text"
  20. e="$fromdir/dir/subdir/foobar.baz"
  21. chmod 6450 "$e" || chmod 2450 "$e" || chmod 1450 "$e" || chmod 450 "$e"
  22. e="$fromdir/dir/subdir/subsubdir/etc-ltr-list"
  23. chmod 2670 "$e" || chmod 1670 "$e" || chmod 670 "$e"
  24. # First a normal copy.
  25. runtest "normal copy" 'checkit "$RSYNC -avv --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
  26. # Then we update all the files.
  27. runtest "update copy" 'checkit "$RSYNC -avvI --no-whole-file --temp-dir=\"$tmpdir2\" \"$fromdir/\" \"$todir\"" "$fromdir" "$todir"'
  28. # The script would have aborted on error, so getting here means we've won.
  29. exit 0