Fixed failing hunks.
[rsync/rsync-patches.git] / atimes.diff
index e098d5d..9e7f7d8 100644 (file)
@@ -15,17 +15,17 @@ command before "make":
                rprintf(FINFO, "flist->length=%.0f\n",
                        (double) fptr[i]->length);
                rprintf(FINFO, "flist->mode=%#o\n", (int) fptr[i]->mode);
---- orig/flist.c       2005-01-21 00:35:26
+--- orig/flist.c       2005-01-24 01:43:09
 +++ flist.c    2004-07-03 20:15:41
-@@ -59,6 +59,7 @@ extern int relative_paths;
- extern int implied_dirs;
+@@ -64,6 +64,7 @@ extern int make_backups;
+ extern int backup_suffix_len;
  extern int copy_links;
  extern int copy_unsafe_links;
 +extern int copy_atimes;
  extern int protocol_version;
  extern int sanitize_paths;
  extern int delete_excluded;
-@@ -143,17 +144,17 @@ static void list_file_entry(struct file_
+@@ -149,17 +150,17 @@ static void list_file_entry(struct file_
  
  #if SUPPORT_LINKS
        if (preserve_links && S_ISLNK(f->mode)) {
@@ -47,7 +47,7 @@ command before "make":
        }
  }
  
-@@ -334,6 +335,7 @@ void send_file_entry(struct file_struct 
+@@ -340,6 +341,7 @@ void send_file_entry(struct file_struct 
  {
        unsigned short flags;
        static time_t modtime;
@@ -55,7 +55,7 @@ command before "make":
        static mode_t mode;
        static int64 dev;
        static dev_t rdev;
-@@ -349,7 +351,7 @@ void send_file_entry(struct file_struct 
+@@ -355,7 +357,7 @@ void send_file_entry(struct file_struct 
  
        if (!file) {
                write_byte(f, 0);
@@ -64,7 +64,7 @@ command before "make":
                dev = 0, rdev = makedev(0, 0);
                rdev_major = 0;
                uid = 0, gid = 0;
-@@ -398,6 +400,12 @@ void send_file_entry(struct file_struct 
+@@ -404,6 +406,12 @@ void send_file_entry(struct file_struct 
                flags |= XMIT_SAME_TIME;
        else
                modtime = file->modtime;
@@ -77,7 +77,7 @@ command before "make":
  
  #if SUPPORT_HARD_LINKS
        if (file->link_u.idev) {
-@@ -453,6 +461,8 @@ void send_file_entry(struct file_struct 
+@@ -459,6 +467,8 @@ void send_file_entry(struct file_struct 
                write_int(f, modtime);
        if (!(flags & XMIT_SAME_MODE))
                write_int(f, to_wire_mode(mode));
@@ -86,7 +86,7 @@ command before "make":
        if (preserve_uid && !(flags & XMIT_SAME_UID)) {
                if (!numeric_ids)
                        add_uid(uid);
-@@ -526,6 +536,7 @@ void receive_file_entry(struct file_stru
+@@ -532,6 +542,7 @@ void receive_file_entry(struct file_stru
                        struct file_list *flist, int f)
  {
        static time_t modtime;
@@ -94,7 +94,7 @@ command before "make":
        static mode_t mode;
        static int64 dev;
        static dev_t rdev;
-@@ -542,7 +553,7 @@ void receive_file_entry(struct file_stru
+@@ -550,7 +561,7 @@ void receive_file_entry(struct file_stru
        struct file_struct *file;
  
        if (!fptr) {
@@ -103,7 +103,7 @@ command before "make":
                dev = 0, rdev = makedev(0, 0);
                rdev_major = 0;
                uid = 0, gid = 0;
-@@ -597,6 +608,8 @@ void receive_file_entry(struct file_stru
+@@ -606,6 +617,8 @@ void receive_file_entry(struct file_stru
                modtime = (time_t)read_int(f);
        if (!(flags & XMIT_SAME_MODE))
                mode = from_wire_mode(read_int(f));
@@ -112,15 +112,15 @@ command before "make":
  
        if (preserve_uid && !(flags & XMIT_SAME_UID))
                uid = (uid_t)read_int(f);
-@@ -647,6 +660,7 @@ void receive_file_entry(struct file_stru
+@@ -656,6 +669,7 @@ void receive_file_entry(struct file_stru
  
-       file->flags = flags & XMIT_DEL_START ? FLAG_DEL_START : 0;
+       file->flags = 0;
        file->modtime = modtime;
 +      file->atime = atime;
        file->length = file_length;
        file->mode = mode;
        file->uid = uid;
-@@ -873,6 +887,7 @@ skip_excludes:
+@@ -896,6 +910,7 @@ skip_excludes:
  
        file->flags = flags;
        file->modtime = st.st_mtime;
@@ -128,9 +128,9 @@ command before "make":
        file->length = st.st_size;
        file->mode = st.st_mode;
        file->uid = st.st_uid;
---- orig/generator.c   2005-01-20 23:05:34
+--- orig/generator.c   2005-01-24 01:43:09
 +++ generator.c        2004-11-03 23:02:12
-@@ -96,7 +96,7 @@ static int unchanged_file(char *fn, stru
+@@ -97,7 +97,7 @@ static int unchanged_file(char *fn, stru
        if (ignore_times)
                return 0;
  
@@ -139,7 +139,7 @@ command before "make":
  }
  
  
-@@ -492,7 +492,7 @@ static void recv_generator(char *fname, 
+@@ -497,7 +497,7 @@ static void recv_generator(char *fname, 
        }
  
        if (update_only && fnamecmp_type == FNAMECMP_FNAME
@@ -148,85 +148,91 @@ command before "make":
                if (verbose > 1)
                        rprintf(FINFO, "%s is newer\n", safe_fname(fname));
                return;
---- orig/options.c     2005-01-20 23:05:34
-+++ options.c  2004-07-03 20:15:41
-@@ -48,6 +48,7 @@ int preserve_devices = 0;
- int preserve_uid = 0;
+--- orig/options.c     2005-01-24 01:43:10
++++ options.c  2005-01-24 01:51:48
+@@ -49,6 +49,7 @@ int preserve_uid = 0;
  int preserve_gid = 0;
  int preserve_times = 0;
+ int omit_dir_times = 0;
 +int copy_atimes = 0;
  int update_only = 0;
  int cvs_exclude = 0;
  int dry_run = 0;
-@@ -261,6 +262,7 @@ void usage(enum logcode F)
+@@ -265,6 +266,7 @@ void usage(enum logcode F)
    rprintf(F," -g, --group                 preserve group\n");
    rprintf(F," -D, --devices               preserve devices (root only)\n");
    rprintf(F," -t, --times                 preserve times\n");
 +  rprintf(F," -A, --copy-atimes           copy access times\n");
+   rprintf(F," -O, --omit-dir-times        omit directories when preserving times\n");
    rprintf(F," -S, --sparse                handle sparse files efficiently\n");
    rprintf(F," -n, --dry-run               show what would have been transferred\n");
-   rprintf(F," -W, --whole-file            copy whole files, no incremental checks\n");
-@@ -367,6 +369,7 @@ static struct poptOption long_options[] 
-   {"group",           'g', POPT_ARG_NONE,   &preserve_gid, 0, 0, 0 },
+@@ -376,6 +378,7 @@ static struct poptOption long_options[] 
    {"devices",         'D', POPT_ARG_NONE,   &preserve_devices, 0, 0, 0 },
    {"times",           't', POPT_ARG_NONE,   &preserve_times, 0, 0, 0 },
+   {"omit-dir-times",  'O', POPT_ARG_NONE,   &omit_dir_times, 0, 0, 0 },
 +  {"copy-atimes",     'A', POPT_ARG_NONE,   &copy_atimes, 0, 0, 0 },
    {"checksum",        'c', POPT_ARG_NONE,   &always_checksum, 0, 0, 0 },
    {"verbose",         'v', POPT_ARG_NONE,   0, 'v', 0, 0 },
    {"quiet",           'q', POPT_ARG_NONE,   0, 'q', 0, 0 },
-@@ -1080,6 +1083,8 @@ void server_options(char **args,int *arg
+@@ -1088,6 +1091,8 @@ void server_options(char **args,int *arg
                argstr[x++] = 'D';
        if (preserve_times)
                argstr[x++] = 't';
 +      if (copy_atimes)
 +              argstr[x++] = 'A';
+       if (omit_dir_times && am_sender)
+               argstr[x++] = 'O';
        if (preserve_perms)
-               argstr[x++] = 'p';
-       if (recurse)
---- orig/rsync.c       2005-01-20 23:52:09
-+++ rsync.c    2004-08-13 08:17:28
-@@ -25,6 +25,7 @@
- extern int verbose;
+--- orig/rsync.c       2005-01-24 00:57:24
++++ rsync.c    2005-01-24 01:59:12
+@@ -26,6 +26,7 @@ extern int verbose;
  extern int dry_run;
  extern int preserve_times;
+ extern int omit_dir_times;
 +extern int copy_atimes;
  extern int am_root;
  extern int am_sender;
  extern int am_generator;
-@@ -167,17 +168,32 @@ int set_perms(char *fname,struct file_st
+@@ -153,6 +154,7 @@ int set_perms(char *fname,struct file_st
+       int updated = 0;
+       STRUCT_STAT st2;
+       int change_uid, change_gid;
++      time_t atime, mtime;
+       if (!st) {
+               if (dry_run)
+@@ -165,18 +167,28 @@ int set_perms(char *fname,struct file_st
+               st = &st2;
+       }
++      if (!copy_atimes || S_ISLNK(st->st_mode) || S_ISDIR(st->st_mode))
++              flags |= PERMS_SKIP_ATIME;
        if (!preserve_times || S_ISLNK(st->st_mode)
-           || (make_backups && !backup_dir && S_ISDIR(st->st_mode)))
+        || (S_ISDIR(st->st_mode)
+         && (omit_dir_times || (make_backups && !backup_dir))))
                flags |= PERMS_SKIP_MTIME;
--      if (!(flags & PERMS_SKIP_MTIME)
++      if (!(flags & PERMS_SKIP_ATIME)
++          && cmp_time(st->st_atime, file->atime) != 0) {
++              atime = file->atime;
++              updated = 1;
++      } else
++              atime = st->st_atime;
+       if (!(flags & PERMS_SKIP_MTIME)
 -          && cmp_modtime(st->st_mtime, file->modtime) != 0) {
-+      if (!copy_atimes || S_ISLNK(st->st_mode) || S_ISDIR(st->st_mode))
-+              flags |= PERMS_SKIP_ATIME;
-+      if ((flags & (PERMS_SKIP_MTIME|PERMS_SKIP_ATIME))
-+          != (PERMS_SKIP_MTIME|PERMS_SKIP_ATIME)) {
-+              time_t atime, mtime;
-+
-+              if (!(flags & PERMS_SKIP_ATIME)
-+                  && cmp_time(st->st_atime, file->atime) != 0) {
-+                      atime = file->atime;
-+                      updated = 1;
-+              } else
-+                      atime = st->st_atime;
-+              if (!(flags & PERMS_SKIP_MTIME)
-+                  && cmp_time(st->st_mtime, file->modtime) != 0) {
-+                      mtime = file->modtime;
-+                      updated = 1;
-+              } else
-+                      mtime = st->st_mtime;
-               /* don't complain about not setting times on directories
-                * because some filesystems can't do it */
--              if (set_modtime(fname,file->modtime) != 0 &&
-+              if (updated && set_times(fname, mtime, atime) != 0 &&
-                   !S_ISDIR(st->st_mode)) {
-                       rsyserr(FERROR, errno, "failed to set times on %s",
-                               full_fname(fname));
-                       return 0;
-               }
--              updated = 1;
+-              if (set_modtime(fname,file->modtime) != 0) {
+-                      rsyserr(FERROR, errno, "failed to set times on %s",
+-                              full_fname(fname));
+-                      return 0;
+-              }
++          && cmp_time(st->st_mtime, file->modtime) != 0) {
++              mtime = file->modtime;
+               updated = 1;
++      } else
++              mtime = st->st_mtime;
++      if (updated && set_times(fname, mtime, atime) != 0) {
++              rsyserr(FERROR, errno, "failed to set times on %s",
++                      full_fname(fname));
++              return 0;
        }
  
        change_uid = am_root && preserve_uid && st->st_uid != file->uid;
@@ -256,19 +262,19 @@ command before "make":
        uid_t uid;
        gid_t gid;
        mode_t mode;
---- orig/rsync.yo      2005-01-20 19:47:08
-+++ rsync.yo   2004-07-03 20:15:41
-@@ -330,6 +330,7 @@ verb(
-  -g, --group                 preserve group
+--- orig/rsync.yo      2005-01-24 01:43:10
++++ rsync.yo   2005-01-24 01:57:18
+@@ -332,6 +332,7 @@ verb(
   -D, --devices               preserve devices (root only)
   -t, --times                 preserve times
+  -O, --omit-dir-times        omit directories when preserving times
 + -A, --copy-atimes           copy access times
   -S, --sparse                handle sparse files efficiently
   -n, --dry-run               show what would have been transferred
   -W, --whole-file            copy whole files, no incremental checks
-@@ -630,6 +631,11 @@ cause the next transfer to behave as if 
- updated (though the rsync algorithm will make the update fairly efficient
- if the files haven't actually changed, you're much better off using -t).
+@@ -644,6 +645,11 @@ dit(bf(-O, --omit-dir-times)) This tells
+ the preserving of modification times is enabled (see --times).  If NFS
+ is sharing the files on the receiving end, it is a good idea to use -O.
  
 +dit(bf(-A, --copy-atimes)) This tells rsync to transfer access times
 +along with the files and update them on the remote system.  Note that