1 After applying this patch, run these commands for a successful build:
4 ./configure (optional if already run)
8 --- orig/flist.c 2006-01-31 02:30:18
9 +++ flist.c 2006-01-27 00:33:39
10 @@ -51,6 +51,7 @@ extern int preserve_devices;
11 extern int preserve_specials;
12 extern int preserve_uid;
13 extern int preserve_gid;
14 +extern int preserve_atimes;
15 extern int relative_paths;
16 extern int implied_dirs;
17 extern int prune_empty_dirs;
18 @@ -85,7 +86,13 @@ void init_flist(void)
21 /* Figure out how big the file_struct is without trailing padding */
22 - file_struct_len = offsetof(struct file_struct, flags) + sizeof f.flags;
23 + if (preserve_atimes)
24 + file_struct_len = offsetof(struct file_struct, fl4g5);
26 + file_struct_len = offsetof(struct file_struct, atime);
27 + /* The "flags" uchar is no longer accessed directly, so I
28 + * mangled the name to fl4g5 as a reminder. */
29 + file_struct_len += sizeof f.fl4g5;
30 checksum_len = protocol_version < 21 ? 2 : MD4_SUM_LENGTH;
33 @@ -141,16 +148,18 @@ static void list_file_entry(struct file_
36 if (preserve_links && S_ISLNK(f->mode)) {
37 - rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
38 + rprintf(FINFO, "%s %11.0f %s %s %s -> %s\n",
40 (double)f->length, timestring(f->modtime),
41 + preserve_atimes ? timestring(f->atime) : "",
42 f_name(f, NULL), f->u.link);
46 - rprintf(FINFO, "%s %11.0f %s %s\n",
47 + rprintf(FINFO, "%s %11.0f %s %s %s\n",
49 (double)f->length, timestring(f->modtime),
50 + preserve_atimes ? timestring(f->atime) : "",
54 @@ -312,6 +321,7 @@ static void send_file_entry(struct file_
57 static time_t modtime;
58 + static time_t atime;
62 @@ -327,7 +337,7 @@ static void send_file_entry(struct file_
66 - modtime = 0, mode = 0;
67 + modtime = 0, atime = 0, mode = 0;
68 dev = 0, rdev = makedev(0, 0);
71 @@ -339,7 +349,7 @@ static void send_file_entry(struct file_
75 - flags = file->flags & XMIT_TOP_DIR;
76 + flags = FFLAGS(file) & XMIT_TOP_DIR;
78 if (file->mode == mode)
79 flags |= XMIT_SAME_MODE;
80 @@ -375,6 +385,12 @@ static void send_file_entry(struct file_
81 flags |= XMIT_SAME_TIME;
83 modtime = file->modtime;
84 + if (preserve_atimes && !S_ISDIR(mode)) {
85 + if (file->atime == atime)
86 + flags |= XMIT_SAME_ATIME;
88 + atime = file->atime;
91 #ifdef SUPPORT_HARD_LINKS
92 if (file->link_u.idev) {
93 @@ -428,6 +444,8 @@ static void send_file_entry(struct file_
94 write_int(f, modtime);
95 if (!(flags & XMIT_SAME_MODE))
96 write_int(f, to_wire_mode(mode));
97 + if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
98 + write_int(f, atime);
99 if (preserve_uid && !(flags & XMIT_SAME_UID)) {
102 @@ -496,6 +514,7 @@ static struct file_struct *receive_file_
103 unsigned short flags, int f)
105 static time_t modtime;
106 + static time_t atime;
110 @@ -514,7 +533,7 @@ static struct file_struct *receive_file_
111 struct file_struct *file;
114 - modtime = 0, mode = 0;
115 + modtime = 0, atime = 0, mode = 0;
116 dev = 0, rdev = makedev(0, 0);
119 @@ -570,6 +589,8 @@ static struct file_struct *receive_file_
120 modtime = (time_t)read_int(f);
121 if (!(flags & XMIT_SAME_MODE))
122 mode = from_wire_mode(read_int(f));
123 + if (preserve_atimes && !S_ISDIR(mode) && !(flags & XMIT_SAME_ATIME))
124 + atime = (time_t)read_int(f);
126 if (chmod_modes && !S_ISLNK(mode))
127 mode = tweak_mode(mode, chmod_modes);
128 @@ -625,6 +646,8 @@ static struct file_struct *receive_file_
132 + if (preserve_atimes)
133 + file->atime = atime;
136 file->dirname = lastdir = bp;
137 @@ -650,12 +673,12 @@ static struct file_struct *receive_file_
138 && lastname[del_hier_name_len-1] == '.'
139 && lastname[del_hier_name_len-2] == '/')
140 del_hier_name_len -= 2;
141 - file->flags |= FLAG_TOP_DIR | FLAG_DEL_HERE;
142 + FFLAGS(file) |= FLAG_TOP_DIR | FLAG_DEL_HERE;
143 } else if (in_del_hier) {
144 if (!relative_paths || !del_hier_name_len
145 || (l1 >= del_hier_name_len
146 && lastname[del_hier_name_len] == '/'))
147 - file->flags |= FLAG_DEL_HERE;
148 + FFLAGS(file) |= FLAG_DEL_HERE;
152 @@ -871,12 +894,14 @@ struct file_struct *make_file(char *fnam
153 memset(bp, 0, file_struct_len);
154 bp += file_struct_len;
156 - file->flags = flags;
157 + FFLAGS(file) = flags;
158 file->modtime = st.st_mtime;
159 file->length = st.st_size;
160 file->mode = st.st_mode;
161 file->uid = st.st_uid;
162 file->gid = st.st_gid;
163 + if (preserve_atimes)
164 + file->atime = st.st_atime;
166 #ifdef SUPPORT_HARD_LINKS
167 if (flist && flist->hlink_pool) {
168 @@ -989,7 +1014,7 @@ static void send_if_directory(int f, str
169 char is_dot_dir = fbuf[ol-1] == '.' && (ol == 1 || fbuf[ol-2] == '/');
171 if (S_ISDIR(file->mode)
172 - && !(file->flags & FLAG_MOUNT_POINT) && f_name(file, fbuf)) {
173 + && !(FFLAGS(file) & FLAG_MOUNT_POINT) && f_name(file, fbuf)) {
175 unsigned int len = strlen(fbuf);
176 if (len > 1 && fbuf[len-1] == '/')
177 @@ -1595,8 +1620,9 @@ static void clean_flist(struct file_list
179 /* Make sure we don't lose track of a user-specified
181 - flist->files[keep]->flags |= flist->files[drop]->flags
182 - & (FLAG_TOP_DIR|FLAG_DEL_HERE);
183 + FFLAGS(flist->files[keep])
184 + |= FFLAGS(flist->files[drop])
185 + & (FLAG_TOP_DIR|FLAG_DEL_HERE);
187 clear_file(flist->files[drop], flist);
189 @@ -1720,7 +1746,7 @@ static void output_flist(struct file_lis
190 file->dirname ? file->dirname : "",
191 file->dirname ? "/" : "", NS(file->basename),
192 S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
193 - (double)file->length, uidbuf, gidbuf, file->flags);
194 + (double)file->length, uidbuf, gidbuf, FFLAGS(file));
198 --- orig/generator.c 2006-02-05 06:40:40
199 +++ generator.c 2006-02-01 19:37:52
200 @@ -44,6 +44,7 @@ extern int preserve_perms;
201 extern int preserve_uid;
202 extern int preserve_gid;
203 extern int preserve_times;
204 +extern int preserve_atimes;
205 extern int omit_dir_times;
206 extern int delete_mode;
207 extern int delete_before;
208 @@ -91,6 +92,7 @@ extern dev_t filesystem_dev;
209 extern char *backup_dir;
210 extern char *backup_suffix;
211 extern int backup_suffix_len;
212 +extern unsigned int file_struct_len;
213 extern struct file_list *the_file_list;
214 extern struct filter_list_struct server_filter_list;
216 @@ -185,7 +187,7 @@ static int delete_item(char *fname, int
217 for (j = dirlist->count; j--; ) {
218 struct file_struct *fp = dirlist->files[j];
220 - if (fp->flags & FLAG_MOUNT_POINT)
221 + if (FFLAGS(fp) & FLAG_MOUNT_POINT)
224 strlcpy(p, fp->basename, remainder);
225 @@ -263,7 +265,7 @@ static void delete_in_dir(struct file_li
226 filt_array[cur_depth] = push_local_filters(fbuf, dlen);
228 if (one_file_system) {
229 - if (file->flags & FLAG_TOP_DIR)
230 + if (FFLAGS(file) & FLAG_TOP_DIR)
231 filesystem_dev = stp->st_dev;
232 else if (filesystem_dev != stp->st_dev)
234 @@ -275,7 +277,7 @@ static void delete_in_dir(struct file_li
235 * from the filesystem. */
236 for (i = dirlist->count; i--; ) {
237 struct file_struct *fp = dirlist->files[i];
238 - if (!fp->basename || fp->flags & FLAG_MOUNT_POINT)
239 + if (!fp->basename || FFLAGS(fp) & FLAG_MOUNT_POINT)
241 if (flist_find(flist, fp) < 0) {
243 @@ -301,11 +303,11 @@ static void do_delete_pass(struct file_l
244 for (j = 0; j < flist->count; j++) {
245 struct file_struct *file = flist->files[j];
247 - if (!(file->flags & FLAG_DEL_HERE))
248 + if (!(FFLAGS(file) & FLAG_DEL_HERE))
252 - if (verbose > 1 && file->flags & FLAG_TOP_DIR)
253 + if (verbose > 1 && FFLAGS(file) & FLAG_TOP_DIR)
254 rprintf(FINFO, "deleting in %s\n", fbuf);
256 if (link_stat(fbuf, &st, keep_dirlinks) < 0
257 @@ -347,8 +349,11 @@ void itemize(struct file_struct *file, i
258 iflags |= ITEM_REPORT_SIZE;
259 if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
260 && (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
261 - || (keep_time && cmp_modtime(file->modtime, st->st_mtime) != 0))
262 + || (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
263 iflags |= ITEM_REPORT_TIME;
264 + if (preserve_atimes && !S_ISDIR(file->mode) && !S_ISLNK(file->mode)
265 + && cmp_time(file->atime, st->st_atime) != 0)
266 + iflags |= ITEM_REPORT_ATIME;
267 if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
268 iflags |= ITEM_REPORT_PERMS;
269 if (preserve_uid && am_root && file->uid != st->st_uid)
270 @@ -396,7 +401,7 @@ int unchanged_file(char *fn, struct file
274 - return cmp_modtime(st->st_mtime, file->modtime) == 0;
275 + return cmp_time(st->st_mtime, file->modtime) == 0;
279 @@ -550,13 +555,13 @@ static int find_fuzzy(struct file_struct
282 if (!S_ISREG(fp->mode) || !fp->length
283 - || fp->flags & FLAG_NO_FUZZY)
284 + || FFLAGS(fp) & FLAG_NO_FUZZY)
289 if (fp->length == file->length
290 - && cmp_modtime(fp->modtime, file->modtime) == 0) {
291 + && cmp_time(fp->modtime, file->modtime) == 0) {
294 "fuzzy size/modtime match for %s\n",
295 @@ -632,7 +637,7 @@ static int try_dests_reg(struct file_str
296 if (!unchanged_attrs(file, stp))
298 if ((always_checksum || ignore_times)
299 - && cmp_modtime(stp->st_mtime, file->modtime))
300 + && cmp_time(stp->st_mtime, file->modtime))
304 @@ -659,6 +664,8 @@ static int try_dests_reg(struct file_str
305 itemizing && verbose > 1,
308 + if (preserve_atimes)
309 + set_file_attrs(fname, file, stp, 0);
310 if (preserve_hard_links && file->link_u.links)
311 hard_link_cluster(file, ndx, itemizing, code);
312 } else if (itemizing)
313 @@ -894,7 +901,7 @@ static void recv_generator(char *fname,
314 && verbose && code && f_out != -1)
315 rprintf(code, "%s/\n", fname);
316 if (delete_during && f_out != -1 && !phase && dry_run < 2
317 - && (file->flags & FLAG_DEL_HERE))
318 + && (FFLAGS(file) & FLAG_DEL_HERE))
319 delete_in_dir(the_file_list, fname, file, &st);
322 @@ -1073,7 +1080,7 @@ static void recv_generator(char *fname,
325 if (update_only && statret == 0
326 - && cmp_modtime(st.st_mtime, file->modtime) > 0) {
327 + && cmp_time(st.st_mtime, file->modtime) > 0) {
329 rprintf(FINFO, "%s is newer\n", fname);
331 @@ -1176,7 +1183,7 @@ static void recv_generator(char *fname,
333 int j = flist_find(fuzzy_dirlist, file);
334 if (j >= 0) /* don't use changing file as future fuzzy basis */
335 - fuzzy_dirlist->files[j]->flags |= FLAG_NO_FUZZY;
336 + FFLAGS(fuzzy_dirlist->files[j]) |= FLAG_NO_FUZZY;
340 --- orig/hlink.c 2006-01-14 20:27:09
341 +++ hlink.c 2006-01-24 19:17:58
342 @@ -26,6 +26,7 @@ extern int link_dest;
343 extern int make_backups;
344 extern int log_format_has_i;
345 extern char *basis_dir[];
346 +extern unsigned int file_struct_len;
347 extern struct file_list *the_file_list;
349 #ifdef SUPPORT_HARD_LINKS
350 @@ -86,10 +87,10 @@ static void link_idev_data(void)
351 FPTR(cur)->link_u.links = pool_talloc(hlink_pool,
352 struct hlink, 1, "hlink_list");
354 - FPTR(head)->flags |= FLAG_HLINK_TOL;
355 + FFLAGS(FPTR(head)) |= FLAG_HLINK_TOL;
356 FPTR(cur)->F_HLINDEX = to;
357 FPTR(cur)->F_NEXT = head;
358 - FPTR(cur)->flags |= FLAG_HLINK_EOL;
359 + FFLAGS(FPTR(cur)) |= FLAG_HLINK_EOL;
360 hlink_list[to++] = head;
362 FPTR(cur)->link_u.links = NULL;
363 @@ -175,7 +176,7 @@ int hard_link_check(struct file_struct *
365 #ifdef SUPPORT_HARD_LINKS
367 - if (skip && !(file->flags & FLAG_HLINK_EOL))
368 + if (skip && !(FFLAGS(file) & FLAG_HLINK_EOL))
369 head = hlink_list[file->F_HLINDEX] = file->F_NEXT;
371 head = hlink_list[file->F_HLINDEX];
372 @@ -270,8 +271,8 @@ void hard_link_cluster(struct file_struc
373 file->F_HLINDEX = FINISHED_LINK;
374 if (link_stat(f_name(file, hlink1), &st1, 0) < 0)
376 - if (!(file->flags & FLAG_HLINK_TOL)) {
377 - while (!(file->flags & FLAG_HLINK_EOL)) {
378 + if (!(FFLAGS(file) & FLAG_HLINK_TOL)) {
379 + while (!(FFLAGS(file) & FLAG_HLINK_EOL)) {
383 @@ -286,6 +287,6 @@ void hard_link_cluster(struct file_struc
384 maybe_hard_link(file, ndx, hlink2, statret, &st2,
385 hlink1, &st1, itemizing, code);
386 file->F_HLINDEX = FINISHED_LINK;
387 - } while (!(file->flags & FLAG_HLINK_EOL));
388 + } while (!(FFLAGS(file) & FLAG_HLINK_EOL));
391 --- orig/log.c 2006-02-05 04:53:34
392 +++ log.c 2006-01-24 22:50:01
393 @@ -41,6 +41,7 @@ extern int module_id;
394 extern int msg_fd_out;
395 extern int protocol_version;
396 extern int preserve_times;
397 +extern int preserve_atimes;
398 extern int log_format_has_i;
399 extern int log_format_has_o_or_i;
400 extern int daemon_log_format_has_o_or_i;
401 @@ -607,10 +608,12 @@ static void log_formatted(enum logcode c
402 n[3] = !(iflags & ITEM_REPORT_SIZE) ? '.' : 's';
403 n[4] = !(iflags & ITEM_REPORT_TIME) ? '.'
404 : !preserve_times || S_ISLNK(file->mode) ? 'T' : 't';
405 - n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
406 - n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
407 - n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
409 + n[5] = !(iflags & ITEM_REPORT_ATIME) ? '.'
410 + : S_ISLNK(file->mode) ? 'U' : 'u';
411 + n[6] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
412 + n[7] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
413 + n[8] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
416 if (iflags & (ITEM_IS_NEW|ITEM_MISSING_DATA)) {
417 char ch = iflags & ITEM_IS_NEW ? '+' : '?';
418 --- orig/options.c 2006-02-03 23:51:57
419 +++ options.c 2006-01-31 03:08:39
420 @@ -52,6 +52,7 @@ int preserve_uid = 0;
421 int preserve_gid = 0;
422 int preserve_times = 0;
423 int omit_dir_times = 0;
424 +int preserve_atimes = 0;
428 @@ -299,8 +300,9 @@ void usage(enum logcode F)
429 rprintf(F," --devices preserve device files (super-user only)\n");
430 rprintf(F," --specials preserve special files\n");
431 rprintf(F," -D same as --devices --specials\n");
432 - rprintf(F," -t, --times preserve times\n");
433 - rprintf(F," -O, --omit-dir-times omit directories when preserving times\n");
434 + rprintf(F," -t, --times preserve modify times\n");
435 + rprintf(F," -O, --omit-dir-times omit directories when preserving modify times\n");
436 + rprintf(F," -U, --atimes preserve access (use) times\n");
437 rprintf(F," --super receiver attempts super-user activities\n");
438 rprintf(F," -S, --sparse handle sparse files efficiently\n");
439 rprintf(F," -n, --dry-run show what would have been transferred\n");
440 @@ -412,6 +414,9 @@ static struct poptOption long_options[]
441 {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
442 {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
443 {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
444 + {"atimes", 'U', POPT_ARG_VAL, &preserve_atimes, 1, 0, 0 },
445 + {"no-atimes", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
446 + {"no-k", 0, POPT_ARG_VAL, &preserve_atimes, 0, 0, 0 },
447 {"omit-dir-times", 'O', POPT_ARG_VAL, &omit_dir_times, 2, 0, 0 },
448 {"modify-window", 0, POPT_ARG_INT, &modify_window, OPT_MODIFY_WINDOW, 0, 0 },
449 {"super", 0, POPT_ARG_VAL, &am_root, 2, 0, 0 },
450 @@ -1505,6 +1510,8 @@ void server_options(char **args,int *arg
454 + if (preserve_atimes)
458 else if (preserve_executability && am_sender)
459 --- orig/rsync.c 2006-02-05 15:31:49
460 +++ rsync.c 2006-01-31 03:00:22
461 @@ -37,6 +37,7 @@ extern int preserve_perms;
462 extern int preserve_executability;
463 extern int preserve_times;
464 extern int omit_dir_times;
465 +extern int preserve_atimes;
466 extern int orig_umask;
468 extern int am_server;
469 @@ -116,6 +117,7 @@ int set_file_attrs(char *fname, struct f
472 int change_uid, change_gid;
473 + time_t atime, mtime;
477 @@ -134,18 +136,33 @@ int set_file_attrs(char *fname, struct f
481 + /* This code must be the first update in the function due to
482 + * how it uses the "updated" variable. */
483 if (!preserve_times || (S_ISDIR(st->st_mode) && omit_dir_times))
484 flags |= ATTRS_SKIP_MTIME;
485 + if (!preserve_atimes || S_ISDIR(st->st_mode))
486 + flags |= ATTRS_SKIP_ATIME;
487 if (!(flags & ATTRS_SKIP_MTIME)
488 - && cmp_modtime(st->st_mtime, file->modtime) != 0) {
489 - int ret = set_modtime(fname, file->modtime, st->st_mode);
490 + && cmp_time(st->st_mtime, file->modtime) != 0) {
491 + mtime = file->modtime;
494 + mtime = st->st_mtime;
495 + if (!(flags & ATTRS_SKIP_ATIME)
496 + && cmp_time(st->st_atime, file->atime) != 0) {
497 + atime = file->atime;
500 + atime = st->st_atime;
502 + int ret = set_times(fname, mtime, atime, st->st_mode);
504 rsyserr(FERROR, errno, "failed to set times on %s",
508 - if (ret == 0) /* ret == 1 if symlink could not be set */
510 + if (ret > 0) /* ret == 1 if symlink could not be set */
514 change_uid = am_root && preserve_uid && st->st_uid != file->uid;
515 --- orig/rsync.h 2006-02-03 20:00:36
516 +++ rsync.h 2006-01-24 22:38:08
518 #define XMIT_HAS_IDEV_DATA (1<<9)
519 #define XMIT_SAME_DEV (1<<10)
520 #define XMIT_RDEV_MINOR_IS_SMALL (1<<11)
521 +#define XMIT_SAME_ATIME (1<<12)
523 /* These flags are used in the live flist data. */
527 #define ATTRS_REPORT (1<<0)
528 #define ATTRS_SKIP_MTIME (1<<1)
529 +#define ATTRS_SKIP_ATIME (1<<2)
532 #define NORMAL_FLUSH 0
534 #define FNAMECMP_FUZZY 0x83
536 /* For use by the itemize_changes code */
537 +#define ITEM_REPORT_ATIME (1<<0)
538 #define ITEM_REPORT_CHECKSUM (1<<1)
539 #define ITEM_REPORT_SIZE (1<<2)
540 #define ITEM_REPORT_TIME (1<<3)
541 @@ -520,9 +523,12 @@ struct file_struct {
545 - uchar flags; /* this item MUST remain last */
546 + time_t atime; /* this MUST be second to last */
547 + uchar fl4g5; /* this item MUST remain last */
550 +#define FFLAGS(f) ((uchar*)(f))[file_struct_len-1]
553 * Start the flist array at FLIST_START entries and grow it
554 * by doubling until FLIST_LINEAR then grow by FLIST_LINEAR
555 --- orig/rsync.yo 2006-02-05 15:31:49
556 +++ rsync.yo 2006-01-31 03:06:45
557 @@ -323,8 +323,9 @@ to the detailed description below for a
558 --devices preserve device files (super-user only)
559 --specials preserve special files
560 -D same as --devices --specials
561 - -t, --times preserve times
562 - -O, --omit-dir-times omit directories when preserving times
563 + -t, --times preserve modify times
564 + -O, --omit-dir-times omit directories when preserving mod-times
565 + -U, --atimes preserve access (use) times
566 --super receiver attempts super-user activities
567 -S, --sparse handle sparse files efficiently
568 -n, --dry-run show what would have been transferred
569 @@ -800,6 +801,12 @@ it is preserving modification times (see
570 the directories on the receiving side, it is a good idea to use bf(-O).
571 This option is inferred if you use bf(--backup) without bf(--backup-dir).
573 +dit(bf(-U, --atimes)) This tells rsync to set the access (use) times of the
574 +destination files to the same value as the source files. Note that the
575 +reading of the source file may update the atime of the source files, so
576 +repeated rsync runs with --atimes may be needed if you want to force the
577 +access-time values to be 100% identical on the two systems.
579 dit(bf(--super)) This tells the receiving side to attempt super-user
580 activities even if the receiving rsync wasn't run by the super-user. These
581 activities include: preserving users via the bf(--owner) option, preserving
582 @@ -1307,8 +1314,8 @@ if the receiving rsync is at least versi
583 with older versions of rsync, but that also turns on the output of other
586 -The "%i" escape has a cryptic output that is 8 letters long. The general
587 -format is like the string bf(YXcstpog), where bf(Y) is replaced by the
588 +The "%i" escape has a cryptic output that is 9 letters long. The general
589 +format is like the string bf(YXcstupog), where bf(Y) is replaced by the
590 kind of update being done, bf(X) is replaced by the file-type, and the
591 other letters represent attributes that may be output if they are being
593 @@ -1348,9 +1355,13 @@ quote(itemize(
594 by the file transfer.
595 it() A bf(t) means the modification time is different and is being updated
596 to the sender's value (requires bf(--times)). An alternate value of bf(T)
597 - means that the time will be set to the transfer time, which happens
598 + means that the modify time will be set to the transfer time, which happens
599 anytime a symlink is transferred, or when a file or device is transferred
601 + it() A bf(u) means the access (use) time is different and is being updated to
602 + the sender's value (requires bf(--atimes)). An alternate value of bf(U)
603 + means that the access time will be set to the transfer time, which happens
604 + anytime a symlink is transferred.
605 it() A bf(p) means the permissions are different and are being updated to
606 the sender's value (requires bf(--perms)).
607 it() An bf(o) means the owner is different and is being updated to the
608 --- orig/sender.c 2006-01-14 20:27:10
609 +++ sender.c 2006-01-24 18:10:23
610 @@ -38,6 +38,7 @@ extern int do_progress;
613 extern int write_batch;
614 +extern unsigned int file_struct_len;
615 extern struct stats stats;
616 extern struct file_list *the_file_list;
617 extern char *log_format;
618 @@ -126,7 +127,7 @@ void successful_send(int ndx)
620 file = the_file_list->files[ndx];
621 /* The generator might tell us about symlinks we didn't send. */
622 - if (!(file->flags & FLAG_SENT) && !S_ISLNK(file->mode))
623 + if (!(FFLAGS(file) & FLAG_SENT) && !S_ISLNK(file->mode))
625 if (file->dir.root) {
626 offset = stringjoin(fname, sizeof fname,
627 @@ -370,7 +371,7 @@ void send_files(struct file_list *flist,
628 rprintf(FINFO, "sender finished %s\n", fname);
630 /* Flag that we actually sent this entry. */
631 - file->flags |= FLAG_SENT;
632 + FFLAGS(file) |= FLAG_SENT;
634 make_backups = save_make_backups;
636 --- orig/testsuite/atimes.test 2006-01-24 22:54:53
637 +++ testsuite/atimes.test 2006-01-24 22:54:53
641 +# Test rsync copying atimes
643 +. "$suitedir/rsync.fns"
649 +touch "$fromdir/foo"
650 +touch -a -t 200102031717.42 "$fromdir/foo"
654 +checkit "$RSYNC -rtUgvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
656 +# The script would have aborted on error, so getting here means we've won.
658 --- orig/testsuite/devices.test 2006-01-30 08:12:44
659 +++ testsuite/devices.test 2006-01-26 10:53:43
660 @@ -42,14 +42,14 @@ touch -r "$fromdir/block" "$fromdir/bloc
661 $RSYNC -ai "$fromdir/block" "$todir/block2" \
663 cat <<EOT >"$chkfile"
667 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
669 $RSYNC -ai "$fromdir/block2" "$todir/block" \
671 cat <<EOT >"$chkfile"
675 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
677 @@ -58,7 +58,7 @@ sleep 1
678 $RSYNC -Di "$fromdir/block3" "$todir/block" \
680 cat <<EOT >"$chkfile"
684 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
686 @@ -66,15 +66,15 @@ $RSYNC -aiHvv "$fromdir/" "$todir/" \
689 cat <<EOT >"$chkfile"
694 -hD++++++ block2.5 => block3
703 +hD+++++++ block2.5 => block3
709 if test ! -b "$fromdir/block2.5"; then
710 sed -e '/block2\.5/d' \
711 --- orig/testsuite/itemize.test 2006-02-04 19:52:05
712 +++ testsuite/itemize.test 2006-01-24 22:32:03
713 @@ -29,14 +29,14 @@ ln "$fromdir/foo/config1" "$fromdir/foo/
714 $RSYNC -iplr "$fromdir/" "$todir/" \
716 cat <<EOT >"$chkfile"
719 ->f++++++ bar/baz/rsync
721 ->f++++++ foo/config1
722 ->f++++++ foo/config2
724 -cL++++++ foo/sym -> ../bar/baz/rsync
727 +>f+++++++ bar/baz/rsync
729 +>f+++++++ foo/config1
730 +>f+++++++ foo/config2
732 +cL+++++++ foo/sym -> ../bar/baz/rsync
734 diff $diffopt "$chkfile" "$outfile" || test_fail "test 1 failed"
736 @@ -48,10 +48,10 @@ chmod 601 "$fromdir/foo/config2"
737 $RSYNC -iplrH "$fromdir/" "$todir/" \
739 cat <<EOT >"$chkfile"
740 ->f..T... bar/baz/rsync
741 ->f..T... foo/config1
742 ->f.sTp.. foo/config2
743 -hf..T... foo/extra => foo/config1
744 +>f..T.... bar/baz/rsync
745 +>f..T.... foo/config1
746 +>f.sT.p.. foo/config2
747 +hf..T.... foo/extra => foo/config1
749 diff $diffopt "$chkfile" "$outfile" || test_fail "test 2 failed"
751 @@ -68,11 +68,11 @@ chmod 777 "$todir/bar/baz/rsync"
752 $RSYNC -iplrtc "$fromdir/" "$todir/" \
754 cat <<EOT >"$chkfile"
755 -.f..tp.. bar/baz/rsync
757 -.f..t... foo/config1
758 ->fcstp.. foo/config2
759 -cL..T... foo/sym -> ../bar/baz/rsync
760 +.f..t.p.. bar/baz/rsync
762 +.f..t.... foo/config1
763 +>fcst.p.. foo/config2
764 +cL..T.... foo/sym -> ../bar/baz/rsync
766 diff $diffopt "$chkfile" "$outfile" || test_fail "test 3 failed"
768 @@ -97,15 +97,15 @@ $RSYNC -ivvplrtH "$fromdir/" "$todir/" \
771 cat <<EOT >"$chkfile"
775 -.f...p.. bar/baz/rsync
778 ->f..t... foo/config2
780 -.L foo/sym -> ../bar/baz/rsync
784 +.f....p.. bar/baz/rsync
787 +>f..t.... foo/config2
789 +.L foo/sym -> ../bar/baz/rsync
791 diff $diffopt "$chkfile" "$outfile" || test_fail "test 5 failed"
793 @@ -124,8 +124,8 @@ touch "$todir/foo/config2"
794 $RSYNC -iplrtH "$fromdir/" "$todir/" \
796 cat <<EOT >"$chkfile"
797 -.f...p.. foo/config1
798 ->f..t... foo/config2
799 +.f....p.. foo/config1
800 +>f..t.... foo/config2
802 diff $diffopt "$chkfile" "$outfile" || test_fail "test 7 failed"
804 @@ -134,15 +134,15 @@ $RSYNC -ivvplrtH --copy-dest="$lddir" "$
807 cat <<EOT >"$chkfile"
815 -hf foo/extra => foo/config1
816 -cL..T... foo/sym -> ../bar/baz/rsync
824 +hf foo/extra => foo/config1
825 +cL..T.... foo/sym -> ../bar/baz/rsync
827 diff $diffopt "$chkfile" "$outfile" || test_fail "test 8 failed"
829 @@ -150,11 +150,11 @@ rm -rf "$todir"
830 $RSYNC -iplrtH --copy-dest="$lddir" "$fromdir/" "$todir/" \
832 cat <<EOT >"$chkfile"
837 -hf foo/extra => foo/config1
842 +hf foo/extra => foo/config1
844 diff $diffopt "$chkfile" "$outfile" || test_fail "test 9 failed"
846 @@ -181,15 +181,15 @@ $RSYNC -ivvplrtH --link-dest="$lddir" "$
849 cat <<EOT >"$chkfile"
857 -hf foo/extra => foo/config1
858 -hL foo/sym -> ../bar/baz/rsync
866 +hf foo/extra => foo/config1
867 +hL foo/sym -> ../bar/baz/rsync
869 diff $diffopt "$chkfile" "$outfile" || test_fail "test 11 failed"
871 @@ -197,10 +197,10 @@ rm -rf "$todir"
872 $RSYNC -iplrtH --link-dest="$lddir" "$fromdir/" "$todir/" \
874 cat <<EOT >"$chkfile"
884 diff $diffopt "$chkfile" "$outfile" || test_fail "test 12 failed"
886 @@ -228,14 +228,14 @@ filter_outfile
887 # TODO fix really-old problem when combining -H with --compare-dest:
888 # missing output for foo/extra hard-link (and it might not be updated)!
889 cat <<EOT >"$chkfile"
897 -.L foo/sym -> ../bar/baz/rsync
905 +.L foo/sym -> ../bar/baz/rsync
907 diff $diffopt "$chkfile" "$outfile" || test_fail "test 14 failed"
909 @@ -243,10 +243,10 @@ rm -rf "$todir"
910 $RSYNC -iplrtH --compare-dest="$lddir" "$fromdir/" "$todir/" \
912 cat <<EOT >"$chkfile"
922 diff $diffopt "$chkfile" "$outfile" || test_fail "test 15 failed"
924 --- orig/testsuite/rsync.fns 2006-02-04 19:52:05
925 +++ testsuite/rsync.fns 2005-07-28 00:41:20
926 @@ -66,7 +66,7 @@ printmsg() {
930 - find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls"
931 + find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS
935 @@ -184,6 +184,10 @@ checkit() {
936 # We can just write everything to stdout/stderr, because the
937 # wrapper hides it unless there is a problem.
939 + if test x$TLS_ARGS = x--atime; then
940 + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
943 echo "Running: \"$1\""
946 @@ -191,10 +195,13 @@ checkit() {
950 + if test x$TLS_ARGS != x--atime; then
951 + ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
955 echo "check how the directory listings compare with diff:"
957 - ( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
958 ( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to"
959 diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES
961 --- orig/tls.c 2005-09-24 17:40:31
962 +++ tls.c 2005-03-23 17:49:48
969 #define PROGRAM "tls"
971 @@ -48,6 +49,7 @@ int read_only = 1;
973 int preserve_perms = 0;
975 +static int display_atime = 0;
977 static void failed(char const *what, char const *where)
979 @@ -56,14 +58,29 @@ static void failed(char const *what, cha
983 +static void storetime(char *dest, time_t t)
986 + struct tm *mt = gmtime(&t);
988 + sprintf(dest, "%04d-%02d-%02d %02d:%02d:%02d ",
989 + (int)mt->tm_year + 1900,
990 + (int)mt->tm_mon + 1,
1000 static void list_file(const char *fname)
1003 char permbuf[PERMSTRING_SIZE];
1006 + char mtimebuf[50];
1007 + char atimebuf[50];
1010 if (do_lstat(fname, &buf) < 0)
1011 @@ -96,19 +113,8 @@ static void list_file(const char *fname)
1013 permstring(permbuf, buf.st_mode);
1015 - if (buf.st_mtime) {
1016 - mt = gmtime(&buf.st_mtime);
1018 - sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d",
1019 - (int)mt->tm_year + 1900,
1020 - (int)mt->tm_mon + 1,
1026 - strcpy(datebuf, " ");
1028 + storetime(mtimebuf, buf.st_mtime);
1029 + storetime(atimebuf, buf.st_atime);
1031 /* TODO: Perhaps escape special characters in fname? */
1033 @@ -119,24 +125,55 @@ static void list_file(const char *fname)
1034 (long)minor(buf.st_rdev));
1035 } else /* NB: use double for size since it might not fit in a long. */
1036 printf("%12.0f", (double)buf.st_size);
1037 - printf(" %6ld.%-6ld %6ld %s %s%s\n",
1038 + printf(" %6ld.%-6ld %6ld %s%s%s%s\n",
1039 (long)buf.st_uid, (long)buf.st_gid, (long)buf.st_nlink,
1040 - datebuf, fname, linkbuf);
1041 + mtimebuf, display_atime && !S_ISDIR(buf.st_mode) ? atimebuf : "",
1045 +static struct poptOption long_options[] = {
1046 + /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
1047 + {"atime", 'u', POPT_ARG_NONE, &display_atime, 0, 0, 0},
1048 + {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0},
1052 +static void tls_usage(int ret)
1054 + fprintf(stderr, "usage: " PROGRAM " [--atime | -u] DIR ...\n"
1055 + "Trivial file listing program for portably checking rsync\n");
1060 main(int argc, char *argv[])
1063 - fprintf(stderr, "usage: " PROGRAM " DIR ...\n"
1064 - "Trivial file listing program for portably checking rsync\n");
1067 + const char **extra_args;
1070 + pc = poptGetContext(PROGRAM, argc, (const char **)argv,
1072 + while ((opt = poptGetNextOpt(pc)) != -1) {
1079 + poptBadOption(pc, POPT_BADOPTION_NOALIAS),
1080 + poptStrerror(opt));
1085 - for (argv++; *argv; argv++) {
1088 + extra_args = poptGetArgs(pc);
1089 + if (*extra_args == NULL)
1092 + for (; *extra_args; extra_args++)
1093 + list_file(*extra_args);
1094 + poptFreeContext(pc);
1098 --- orig/util.c 2006-02-03 20:00:36
1099 +++ util.c 2006-01-14 08:20:29
1100 @@ -130,7 +130,7 @@ void overflow_exit(char *str)
1104 -int set_modtime(char *fname, time_t modtime, mode_t mode)
1105 +int set_times(char *fname, time_t modtime, time_t atime, mode_t mode)
1107 #if !defined HAVE_LUTIMES || !defined HAVE_UTIMES
1109 @@ -138,9 +138,13 @@ int set_modtime(char *fname, time_t modt
1113 - rprintf(FINFO, "set modtime of %s to (%ld) %s",
1114 + char mtimebuf[200];
1116 + strlcpy(mtimebuf, timestring(modtime), sizeof mtimebuf);
1118 + "set modtime, atime of %s to (%ld) %s, (%ld) %s\n",
1119 fname, (long)modtime,
1120 - asctime(localtime(&modtime)));
1121 + mtimebuf, (long)atime, timestring(atime));
1125 @@ -149,7 +153,7 @@ int set_modtime(char *fname, time_t modt
1128 struct timeval t[2];
1129 - t[0].tv_sec = time(NULL);
1130 + t[0].tv_sec = atime;
1132 t[1].tv_sec = modtime;
1134 @@ -160,12 +164,12 @@ int set_modtime(char *fname, time_t modt
1135 return utimes(fname, t);
1136 #elif defined HAVE_UTIMBUF
1137 struct utimbuf tbuf;
1138 - tbuf.actime = time(NULL);
1139 + tbuf.actime = atime;
1140 tbuf.modtime = modtime;
1141 return utime(fname,&tbuf);
1142 #elif defined HAVE_UTIME
1144 - t[0] = time(NULL);
1147 return utime(fname,t);
1149 @@ -1183,8 +1187,8 @@ int msleep(int t)
1153 - * Determine if two file modification times are equivalent (either
1154 - * exact or in the modification timestamp window established by
1155 + * Determine if two file times are equivalent (either
1156 + * exact or in the timestamp window established by
1159 * @retval 0 if the times should be treated as the same
1160 @@ -1193,7 +1197,7 @@ int msleep(int t)
1162 * @retval -1 if the 2nd is later
1164 -int cmp_modtime(time_t file1, time_t file2)
1165 +int cmp_time(time_t file1, time_t file2)
1167 if (file2 > file1) {
1168 if (file2 - file1 <= modify_window)