[Unison-hackers] PATCH: Bugfix unison -times support for directories

Robert Hardy rhardy at teledyne.com
Mon Feb 2 18:20:33 EST 2009


There seems to be a bug in the unison -times option in that it ignores
directory times. I found some comments in BUGS.txt that suggests this needed
OCAML changes. I can't see why that comment is there. With some suggestions
from freenode's #ocaml I came up with this patch which works on Linux.

I was syncing large quanties of data between an el4 and el5 box. Ignoring
the directory times caused me a lot of problems.

I suspect this patch should also be extended for Unix.S_LNK as currently
unison with -owner -group -times should set the user/owner for links and it
does not.

Here is a simple patch which in basic testing under el5 seems to fix this problem:

http://webcon.ca/~rhardy/utmp/unison-2.27.57-dir_times.patch

diff -urNbBp unison-2.27.57/props.ml.orig unison-2.27.57/props.ml
--- unison-2.27.57/props.ml.orig	2007-04-01 23:03:20.000000000 -0400
+++ unison-2.27.57/props.ml	2009-02-02 14:22:07.000000000 -0500
@@ -501,6 +501,8 @@ let get stats _ =
    let v = stats.Unix.LargeFile.st_mtime in
    if stats.Unix.LargeFile.st_kind = Unix.S_REG && Prefs.read sync then
      Synced v
+  else if stats.Unix.LargeFile.st_kind = Unix.S_DIR && Prefs.read sync then
+    Synced v
    else
      NotSynced v


Regards,
Rob

--
Robert Hardy, B.Eng Computer Systems
Systems Analyst/Software Developer/I.T. Specialist
Teledyne Controls Simulation
105-2255 St Laurent Blvd
Ottawa, ON K1G 4K3 Canada
+16135262059 ex 355
Fax +16135265751


More information about the Unison-hackers mailing list