Your message dated Fri, 3 Jul 2020 20:38:10 +0100
with message-id 
<cabwkt9rsuvurgddxzs-bc4atvnvj0jho1+3uld0+d9v+ex7...@mail.gmail.com>
and subject line rsync: always modify atime of all destination files
has caused the Debian Bug report #261127,
regarding rsync: always modify atime of all destination files
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
261127: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261127
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: rsync
Version: 2.6.2-2
Severity: wishlist
Tags: patch

  Hi,

  Please apply the following patch to rsync. This patch updates the
atime (last access time) of all destination files to NOW when rsync
runs.

  It is desirable to know if a file has been deleted in then source
and exists in destination. Checking destination computer for atime,
you can know how long this file has been removed from source, and
remove it after some months to keep disk space in backups.

  In destination computer I execute something like this:

    find /backup/directory/ -atime +60 -print -exec rm '{}' ';'

  This way, files that exist in destination and do not exist anymore
in source will be deleted after 60 days.

  The option --delete is not good for this, because it deletes all
files in destination, even if they were removed yesterday acidentally
in source.

  It could also be good to put this behaviour in rsync manpage.

  Thanks,
    Pedro

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.26-1-686
Locale: LANG=C, LC_CTYPE=C (ignored: LC_ALL set to pt_BR)

Versions of packages rsync depends on:
ii  libc6                       2.3.2.ds1-13 GNU C Library: Shared libraries an
ii  libpopt0                    1.7-4        lib for parsing cmdline parameters

-- no debconf information
diff -u rsync-2.6.2.orig/generator.c rsync-2.6.2/generator.c
--- rsync-2.6.2.orig/generator.c        Thu Apr 15 13:55:23 2004
+++ rsync-2.6.2/generator.c     Fri Jul 23 15:47:40 2004
@@ -471,8 +471,10 @@
        }
 
        if (skip_file(fname, file, &st)) {
-               if (fnamecmp == fname)
+               if (fnamecmp == fname) {
                        set_perms(fname,file,&st,1);
+                       update_atime(fname);
+               }
                return;
        }
 
diff -u rsync-2.6.2.orig/proto.h rsync-2.6.2/proto.h
--- rsync-2.6.2.orig/proto.h    Thu Apr 22 06:58:09 2004
+++ rsync-2.6.2/proto.h Fri Jul 23 15:16:17 2004
@@ -242,6 +242,7 @@
 void print_child_argv(char **cmd);
 void out_of_memory(char *str);
 void overflow(char *str);
+void update_atime(char *fname);
 int set_modtime(char *fname, time_t modtime);
 int create_directory_path(char *fname, int base_umask);
 int copy_file(char *source, char *dest, mode_t mode);
diff -u rsync-2.6.2.orig/util.c rsync-2.6.2/util.c
--- rsync-2.6.2.orig/util.c     Tue Apr 27 16:59:37 2004
+++ rsync-2.6.2/util.c  Fri Jul 23 16:53:06 2004
@@ -1135,3 +1135,40 @@
                return malloc(size * num);
        return realloc(ptr, size * num);
 }
+
+/**
+ * update time of last access (atime).
+ * does not modify mtime.
+**/
+void update_atime(char *fname) {
+#if defined(HAVE_UTIME) || defined(HAVE_UTIMES)
+       struct stat st;
+# ifdef HAVE_UTIMBUF
+       struct utimbuf utb;
+# endif
+       if (verbose > 3)
+              rprintf(FINFO, "%s updating atime\n",fname);
+       if (stat(fname, &st) != 0) {
+               rprintf(FERROR, "ERROR: updating atime: could read previous 
mtime, file '%s'\n",fname);
+       } else {
+# ifdef HAVE_UTIME
+              utb.modtime = st.st_mtime;
+              utb.actime = time(NULL);
+              if (utime(fname,&utb) != 0)
+                      rprintf(FERROR, "ERROR: could not update atime of file 
'%s'",fname);
+# else /* HAVE_UTIME */
+              struct timeval t[2];
+              t[0].tv_sec = time(NULL);
+              t[0].tv_usec = 0;
+              t[1].tv_sec = st.st_mtime;
+              t[1].tv_usec = 0;
+              if (utimes(fname,t) != 0)
+                      rprintf(FERROR, "ERROR: could not update atime of file 
'%s'",fname);
+# endif /* HAVE_UTIME */
+       }
+       
+#else /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) */
+       if (verbose > 3)
+              rprintf(FERROR, "%s can not update atime. utime() or utimes() 
not found\n",fname);
+#endif /* defined(HAVE_UTIME) || defined(HAVE_UTIMES) */
+}

--- End Message ---
--- Begin Message ---
Reporter asked to close bug report

-- 
Samuel Henrique <samueloph>

--- End Message ---

Reply via email to