View | Details | Raw Unified | Return to bug 33751 | Differences between
and this patch

Collapse All | Expand All

(-)rsync-3.0.7.orig/generator.c (+18 lines)
 Lines 55-60   extern int ignore_errors; Link Here 
55
extern int remove_source_files;
55
extern int remove_source_files;
56
extern int delay_updates;
56
extern int delay_updates;
57
extern int update_only;
57
extern int update_only;
58
extern int dirs_update_only;
58
extern int ignore_existing;
59
extern int ignore_existing;
59
extern int ignore_non_existing;
60
extern int ignore_non_existing;
60
extern int inplace;
61
extern int inplace;
 Lines 1434-1439   static void recv_generator(char *fname, Link Here 
1434
				dry_missing_dir = file;
1435
				dry_missing_dir = file;
1435
			file->flags |= FLAG_MISSING_DIR;
1436
			file->flags |= FLAG_MISSING_DIR;
1436
		}
1437
		}
1438
1439
		if (dirs_update_only > 0 && statret == 0
1440
		    && cmp_time(sx.st.st_mtime, file->modtime) > 0) {
1441
			if (verbose > 1)
1442
				rprintf(FINFO, "%s is newer\n", fname);
1443
			file->flags |= FLAG_DONT_TOUCH_UP;
1444
			goto cleanup;
1445
		}
1446
1437
		real_ret = statret;
1447
		real_ret = statret;
1438
		real_sx = sx;
1448
		real_sx = sx;
1439
		if (file->flags & FLAG_DIR_CREATED)
1449
		if (file->flags & FLAG_DIR_CREATED)
 Lines 2049-2054   static void touch_up_dirs(struct file_li Link Here 
2049
		if (!S_ISDIR(file->mode)
2059
		if (!S_ISDIR(file->mode)
2050
		 || (!implied_dirs && file->flags & FLAG_IMPLIED_DIR))
2060
		 || (!implied_dirs && file->flags & FLAG_IMPLIED_DIR))
2051
			continue;
2061
			continue;
2062
		if (S_ISDIR(file->mode) && file->flags & FLAG_DONT_TOUCH_UP) {
2063
			fname = f_name(file, NULL);
2064
			if (verbose > 3) {
2065
				rprintf(FINFO, "skipping touch_up_dirs: %s (%d)\n",
2066
					NS(fname), i);
2067
			}
2068
			continue;
2069
		}
2052
		if (verbose > 3) {
2070
		if (verbose > 3) {
2053
			fname = f_name(file, NULL);
2071
			fname = f_name(file, NULL);
2054
			rprintf(FINFO, "touch_up_dirs: %s (%d)\n",
2072
			rprintf(FINFO, "touch_up_dirs: %s (%d)\n",
(-)rsync-3.0.7.orig/options.c (+3 lines)
 Lines 60-65   int preserve_uid = 0; Link Here 
60
int preserve_gid = 0;
60
int preserve_gid = 0;
61
int preserve_times = 0;
61
int preserve_times = 0;
62
int update_only = 0;
62
int update_only = 0;
63
int dirs_update_only = 0;
63
int cvs_exclude = 0;
64
int cvs_exclude = 0;
64
int dry_run = 0;
65
int dry_run = 0;
65
int do_xfers = 1;
66
int do_xfers = 1;
 Lines 326-331   void usage(enum logcode F) Link Here 
326
  rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
327
  rprintf(F,"     --backup-dir=DIR        make backups into hierarchy based in DIR\n");
327
  rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
328
  rprintf(F,"     --suffix=SUFFIX         set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX);
328
  rprintf(F," -u, --update                skip files that are newer on the receiver\n");
329
  rprintf(F," -u, --update                skip files that are newer on the receiver\n");
330
  rprintf(F,"     --dirs-update           skip dirs that are newer on the receiver\n");
329
  rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
331
  rprintf(F,"     --inplace               update destination files in-place (SEE MAN PAGE)\n");
330
  rprintf(F,"     --append                append data onto shorter files\n");
332
  rprintf(F,"     --append                append data onto shorter files\n");
331
  rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
333
  rprintf(F,"     --append-verify         like --append, but with old data in file checksum\n");
 Lines 534-539   static struct poptOption long_options[] Link Here 
534
  {"no-one-file-system",'x',POPT_ARG_VAL,   &one_file_system, 0, 0, 0 },
536
  {"no-one-file-system",'x',POPT_ARG_VAL,   &one_file_system, 0, 0, 0 },
535
  {"no-x",            'x', POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
537
  {"no-x",            'x', POPT_ARG_VAL,    &one_file_system, 0, 0, 0 },
536
  {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
538
  {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
539
  {"dirs-update",      0,  POPT_ARG_NONE,   &dirs_update_only, 0, 0, 0 },
537
  {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
540
  {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
538
  {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
541
  {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
539
  {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
542
  {"ignore-existing",  0,  POPT_ARG_NONE,   &ignore_existing, 0, 0, 0 },
(-)rsync-3.0.7.orig/rsync.h (+1 lines)
 Lines 80-85    Link Here 
80
#define FLAG_LENGTH64 (1<<9)	/* sender/receiver/generator */
80
#define FLAG_LENGTH64 (1<<9)	/* sender/receiver/generator */
81
#define FLAG_SKIP_GROUP (1<<10)	/* receiver/generator */
81
#define FLAG_SKIP_GROUP (1<<10)	/* receiver/generator */
82
#define FLAG_TIME_FAILED (1<<11)/* generator */
82
#define FLAG_TIME_FAILED (1<<11)/* generator */
83
#define FLAG_DONT_TOUCH_UP (1<<12)/* generator */
83
84
84
/* These flags are passed to functions but not stored. */
85
/* These flags are passed to functions but not stored. */
85
86
(-)rsync-3.0.7.orig/rsync.yo (+6 lines)
 Lines 330-335   to the detailed description below for a Link Here 
330
     --backup-dir=DIR        make backups into hierarchy based in DIR
330
     --backup-dir=DIR        make backups into hierarchy based in DIR
331
     --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
331
     --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
332
 -u, --update                skip files that are newer on the receiver
332
 -u, --update                skip files that are newer on the receiver
333
     --dirs-update           skip dirs that are newer on the receiver
333
     --inplace               update destination files in-place
334
     --inplace               update destination files in-place
334
     --append                append data onto shorter files
335
     --append                append data onto shorter files
335
     --append-verify         --append w/old data in file checksum
336
     --append-verify         --append w/old data in file checksum
 Lines 708-713   This option is a transfer rule, not an e Link Here 
708
data that goes into the file-lists, and thus it doesn't affect deletions.
709
data that goes into the file-lists, and thus it doesn't affect deletions.
709
It just limits the files that the receiver requests to be transferred.
710
It just limits the files that the receiver requests to be transferred.
710
711
712
dit(bf(--dirs-update)) This forces rsync to skip modification of the status
713
of directories (i.e. ownership, posix permissions, fACLs, extended attributes)
714
which exist on the destination and have a modified time that is newer than
715
the source directory. Note that the directory content will not be skipped.
716
711
dit(bf(--inplace)) This option changes how rsync transfers a file when
717
dit(bf(--inplace)) This option changes how rsync transfers a file when
712
its data needs to be updated: instead of the default method of creating
718
its data needs to be updated: instead of the default method of creating
713
a new copy of the file and moving it into place when it is complete, rsync
719
a new copy of the file and moving it into place when it is complete, rsync
(-)rsync-3.0.7.orig/testsuite/dirs-update.test (+125 lines)
Line 0    Link Here 
1
#! /bin/sh
2
3
# This program is distributable under the terms of the GNU GPL (see
4
# COPYING).
5
6
# Test that rsync handles dirctory ACL preservation.
7
8
. $srcdir/testsuite/rsync.fns
9
set -x
10
11
$RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
12
13
makepath "$fromdir/sub1"
14
makepath "$fromdir/sub2"
15
makepath "$fromdir/sub3"
16
17
dst_preferred_files='. sub1 sub3'
18
src_preferred_files='sub2 sub1/file1 sub2/file2'
19
20
case "$setfacl_nodef" in
21
true)
22
    if ! chmod --help 2>&1 | fgrep +a >/dev/null; then
23
	test_skipped "I don't know how to use setfacl or chmod for ACLs"
24
    fi
25
    chmod +a "root allow read,write,execute" "$fromdir/sub1" || test_skipped "Your filesystem has ACLs disabled"
26
    chmod +a "admin allow read" "$fromdir/sub1"
27
    chmod +a "daemon allow read,write" "$fromdir/sub1"
28
29
    chmod +a "root allow read,write,execute" "$fromdir/sub2"
30
    chmod +a "admin allow read" "$fromdir/sub2"
31
    chmod +a "daemon allow read,write" "$fromdir/sub2"
32
33
    chmod +a "root allow read,write,execute" "$fromdir/sub3"
34
    chmod +a "admin allow read" "$fromdir/sub3"
35
    chmod +a "daemon allow read,write" "$fromdir/sub3"
36
37
    see_acls() {
38
	ls -le "${@}"
39
    }
40
    ;;
41
*)
42
    setfacl -m u:0:7 "$fromdir/sub1" || test_skipped "Your filesystem has ACLs disabled"
43
    setfacl -m g:1:5 "$fromdir/sub1"
44
    setfacl -m g:2:1 "$fromdir/sub1"
45
    setfacl -m g:0:7 "$fromdir/sub1"
46
    setfacl -m u:2:1 "$fromdir/sub1"
47
    setfacl -m u:1:5 "$fromdir/sub1"
48
49
    setfacl -m u:0:7 "$fromdir/sub2"
50
    setfacl -m g:1:5 "$fromdir/sub2"
51
    setfacl -m g:2:1 "$fromdir/sub2"
52
    setfacl -m g:0:7 "$fromdir/sub2"
53
    setfacl -m u:2:1 "$fromdir/sub2"
54
    setfacl -m u:1:5 "$fromdir/sub2"
55
56
    setfacl -m u:0:7 "$fromdir/sub3"
57
    setfacl -m g:1:5 "$fromdir/sub3"
58
    setfacl -m g:2:1 "$fromdir/sub3"
59
    setfacl -m g:0:7 "$fromdir/sub3"
60
    setfacl -m u:2:1 "$fromdir/sub3"
61
    setfacl -m u:1:5 "$fromdir/sub3"
62
63
    see_acls() {
64
	getfacl "${@}"
65
    }
66
    ;;
67
esac
68
69
$RSYNC -avvA "$fromdir/" "$todir"
70
71
## add file1 to $fromdir/sub1
72
echo else >"$fromdir/sub1/file1"
73
74
sleep 1	## wait a bit for timestamp difference
75
76
## change $todir and $todir/sub*
77
case "$setfacl_nodef" in
78
true)
79
    if ! chmod --help 2>&1 | fgrep +a >/dev/null; then
80
	test_skipped "I don't know how to use setfacl or chmod for ACLs"
81
    fi
82
    chmod +a "nobody allow read,execute" "$todir"
83
    chmod +a "nobody allow read,execute" "$todir/sub1"
84
    chmod +a "nobody allow read,execute" "$todir/sub2"
85
    chmod +a "nobody allow read,execute" "$todir/sub3"
86
    ;;
87
*)
88
    setfacl -m u:65534:5 "$todir"
89
    setfacl -m u:65534:5 "$todir/sub1"
90
    setfacl -m u:65534:5 "$todir/sub2"
91
    setfacl -m u:65534:5 "$todir/sub3"
92
    ;;
93
esac
94
95
sleep 1	## wait a bit for timestamp difference
96
97
## update mtime of $todir and $todir/sub*
98
chown guest "$todir"
99
chown guest "$todir/sub1"
100
chown guest "$todir/sub2"
101
chown guest "$todir/sub3"
102
touch "$todir"
103
touch "$todir/sub1"
104
touch "$todir/sub2"
105
touch "$todir/sub3"
106
107
sleep 1	## wait a bit for timestamp difference
108
109
## add file2 to $fromdir/sub2, this causes the mtime of sub2 to be updated
110
echo else >"$fromdir/sub2/file2"
111
112
cd "$todir"
113
see_acls $dst_preferred_files >"$scratchdir/dst_preferred_acls.txt"
114
115
cd "$fromdir"
116
see_acls $src_preferred_files >"$scratchdir/src_preferred_acls.txt"
117
118
$RSYNC -avvA --update --dirs-update "$fromdir/" "$todir/"
119
120
cd "$todir"
121
see_acls $dst_preferred_files | diff $diffopt "$scratchdir/dst_preferred_acls.txt" -
122
see_acls $src_preferred_files | diff $diffopt "$scratchdir/src_preferred_acls.txt" -
123
124
# The script would have aborted on error, so getting here means we've won.
125
exit 0

Return to bug 33751