Your message dated Thu, 6 Mar 2008 11:38:05 -0500
with message-id <[EMAIL PROTECTED]>
has caused the   report #261127,
regarding rsync: always modify atime of all destination files
to be marked as having been forwarded to the upstream software
author(s) [EMAIL PROTECTED]

(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: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=261127
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Hi Everyone,

The following feature request was received by a Debian user; could you
comment on it?  I think this seems reasonable, but perhaps should be
enabled only conditionally (as if the argument parser isn't stressed
enough).

Thanks,
Justin

On Fri, Jul 23, 2004 at 05:09:09PM -0300, Pedro Zorzenon Neto wrote:
> 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 ---

Reply via email to