On Thu, 2007-04-19 at 10:30 -0700, Wayne Davison wrote:
> On Thu, Apr 19, 2007 at 05:20:59PM +0100, Jon Burgess wrote:
> > I use rsync as a backup tool (via rsnapshot) and noticed that it had a
> > problem with a couple of files which had timestamps way off in the
> > future.
> 
> That's a unix-time limitation.  The current timestamp resolution can't
> represent anything past January 18, 2038.  Fixing that won't be simple,
> but should not really be needed for quite a few more years.
> 
> ..wayne..

The particular problem I see where the timestamps 1940 != 2076 is due to
a 64 bit time_t. On such platforms, increasing the modtime protocol
entity from 4 to 8 bytes is sufficient to fix this. The patch attached
works for me although i'm sure more would need to be done to support
backwards compatibility etc. 

The code also does not attempt to support 64 bit timestamps on 32 bit
systems, which would certainly be more complicated.

        Jon

Index: flist.c
===================================================================
RCS file: /cvsroot/rsync/flist.c,v
retrieving revision 1.400
diff -u -w -p -r1.400 flist.c
--- flist.c	7 Apr 2007 17:22:25 -0000	1.400
+++ flist.c	19 Apr 2007 17:50:03 -0000
@@ -483,7 +483,7 @@ static void send_file_entry(int f, struc
 
 	write_longint(f, F_LENGTH(file));
 	if (!(flags & XMIT_SAME_TIME))
-		write_int(f, modtime);
+		write_longint(f, modtime);
 	if (!(flags & XMIT_SAME_MODE))
 		write_int(f, to_wire_mode(mode));
 	if (preserve_uid && !(flags & XMIT_SAME_UID)) {
@@ -667,7 +667,7 @@ static struct file_struct *recv_file_ent
 
 	file_length = read_longint(f);
 	if (!(flags & XMIT_SAME_TIME))
-		modtime = (time_t)read_int(f);
+		modtime = (time_t)read_longint(f);
 	if (!(flags & XMIT_SAME_MODE))
 		mode = from_wire_mode(read_int(f));
 
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to