File: executability.test

package info (click to toggle)
rsync 2.6.9-2etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,720 kB
  • ctags: 2,572
  • sloc: ansic: 26,590; sh: 4,331; perl: 1,320; makefile: 203; python: 83; awk: 59
file content (47 lines) | stat: -rw-r--r-- 944 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /bin/sh

# This program is distributable under the terms of the GNU GPL (see
# COPYING).

# Test the --executability or -E option. -- Matt McCutchen

. $srcdir/testsuite/rsync.fns

# Put some files in the From directory
mkdir "$fromdir"
cat <<EOF >"$fromdir/1"
#!/bin/sh
echo 'Program One!'
EOF
cat <<EOF >"$fromdir/2"
#!/bin/sh
echo 'Program Two!'
EOF

chmod 1700 "$fromdir/1" || test_skipped "Can't chmod"
chmod 600 "$fromdir/2"

$RSYNC -rvv "$fromdir/" "$todir/"

check_perms "$todir/1" rwx------ 1
check_perms "$todir/2" rw------- 1

# Mix up the permissions a bit
chmod 600 "$fromdir/1"
chmod 601 "$fromdir/2"
chmod 604 "$todir/2"

$RSYNC -rvv "$fromdir/" "$todir/"

# No -E, so nothing should have changed
check_perms "$todir/1" rwx------ 2
check_perms "$todir/2" rw----r-- 2

$RSYNC -rvvE "$fromdir/" "$todir/"

# Now things should have happened!
check_perms "$todir/1" rw------- 3
check_perms "$todir/2" rwx---r-x 3

# Hooray
exit 0