[Unison-hackers] [unison-svn] r410 - trunk/src

vouillon@seas.upenn.edu vouillon at seas.upenn.edu
Wed Feb 17 08:06:39 EST 2010


Author: vouillon
Date: 2010-02-17 08:06:38 -0500 (Wed, 17 Feb 2010)
New Revision: 410

Modified:
   trunk/src/RECENTNEWS
   trunk/src/copy.ml
   trunk/src/mkProjectInfo.ml
   trunk/src/props.ml
   trunk/src/recon.ml
   trunk/src/update.ml
Log:
* Bumped version number: incompatible protocol changes

* Ignore one-second differences when synchronizing modification time.
  (Technically, this is an incompatible archive format change, but it
   is backward compatible.  To trigger a problem, a user would have to
   synchronize modification times on a filesystem with a two-second
   granularity and then downgrade to a previous version of Unison,
   which does not work well in such a case.  Thus, it does not
   seem worthwhile to increment the archive format number, which would
   impact all users.)


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/RECENTNEWS	2010-02-17 13:06:38 UTC (rev 410)
@@ -1,3 +1,17 @@
+CHANGES FROM VERSION 2.40.1
+
+* Bumped version number: incompatible protocol changes
+
+* Ignore one-second differences when synchronizing modification time.
+  (Technically, this is an incompatible archive format change, but it
+   is backward compatible.  To trigger a problem, a user would have to
+   synchronize modification times on a filesystem with a two-second
+   granularity and then downgrade to a previous version of Unison,
+   which does not work well in such a case.  Thus, it does not
+   seem worthwhile to increment the archive format number, which would
+   impact all users.)
+
+-------------------------------
 CHANGES FROM VERSION 2.39.12
 
 * Mac OS: fixed rsync bug which could result in an "index out of bounds"

Modified: trunk/src/copy.ml
===================================================================
--- trunk/src/copy.ml	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/copy.ml	2010-02-17 13:06:38 UTC (rev 410)
@@ -425,7 +425,8 @@
     (fun e ->
        (* We cannot wrap the code above with the handler below,
           as the code is executed asynchronously. *)
-       Util.convertUnixErrorsToTransient "rsync sender" (fun () -> raise e))
+       Util.convertUnixErrorsToTransient "transferring file contents"
+         (fun () -> raise e))
 
 let compressRemotely = Remote.registerServerCmd "compress" compress
 
@@ -694,7 +695,7 @@
      ^ "{\\tt rsync}.")
 
 let copymax =
-  Prefs.createInt "copymax" ~local:true 1
+  Prefs.createInt "copymax" 1
     "!maximum number of simultaneous copyprog transfers"
     ("A number indicating how many instances of the external copying utility \
       Unison is allowed to run simultaneously (default to 1).")

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/mkProjectInfo.ml	2010-02-17 13:06:38 UTC (rev 410)
@@ -5,8 +5,8 @@
 
 let projectName = "unison"
 let majorVersion = 2
-let minorVersion = 39
-let pointVersionOrigin = 396 (* Revision that corresponds to point version 0 *)
+let minorVersion = 40
+let pointVersionOrigin = 409 (* Revision that corresponds to point version 0 *)
 
 (* Documentation:
    This is a program to construct a version of the form Major.Minor.Point,
@@ -42,7 +42,7 @@
 (* ---------------------------------------------------------------------- *)
 (* You shouldn't need to edit below. *)
 
-let revisionString = "$Rev: 402$";;
+let revisionString = "$Rev: 410$";;
 
 (* extract a substring using a regular expression *)
 let extract_str re str =
@@ -101,3 +101,4 @@
 
 
 
+

Modified: trunk/src/props.ml
===================================================================
--- trunk/src/props.ml	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/props.ml	2010-02-17 13:06:38 UTC (rev 410)
@@ -435,37 +435,28 @@
   let v = Int64.rem t oneHour in
   if v >= Int64.zero then v else Int64.add v oneHour
 
+(* Accept one hour differences and one second differences *)
+let possible_deltas =
+  [ -3601L; 3601L; -3600L; 3600L; -3599L; 3599L; -1L; 1L; 0L ]
+
 let hash t h =
   Uutil.hash2
     (match t with
-       Synced f    -> Hashtbl.hash (moduloOneHour (approximate f))
+       Synced _    -> 1 (* As we are ignoring one-second differences,
+                           we cannot provide a more accurate hash. *)
      | NotSynced _ -> 0)
     h
 
+(* Times have a two-second granularity on FAT filesystems.  They are
+   approximated upward under Windows, downward under Linux...
+   Ignoring one-second changes also makes Unison more robust when
+   dealing with systems with sub-second granularity (we have no control
+   on how this is may be rounded). *)
 let similar t t' =
   not (Prefs.read sync)
     ||
   match t, t' with
     Synced v, Synced v'      ->
-      let delta = Int64.sub (approximate v) (approximate v') in
-      delta = Int64.zero || delta = oneHour || delta = minusOneHour
-  | NotSynced _, NotSynced _ ->
-      true
-  | _                        ->
-      false
-
-(* Accept one hour differences and one second differences *)
-let possible_deltas =
-  [ -3601L; 3601L; -3600L; 3600L; -3599L; 3599L; -1L; 1L; 0L ]
-
-(* FIX: this is the right similar function (dates are approximated
-   on FAT filesystems upward under Windows, downward under Linux).
-   The hash function needs to be updated as well *)
-let similar_correct t t' =
-  not (Prefs.read sync)
-    ||
-  match t, t' with
-    Synced v, Synced v'      ->
       List.mem (Int64.sub (Int64.of_float v)  (Int64.of_float v'))
         possible_deltas
   | NotSynced _, NotSynced _ ->
@@ -564,7 +555,7 @@
       ()
   | Synced v ->
       let t' = Synced (stats.Unix.LargeFile.st_mtime) in
-      if not (similar_correct t t') then
+      if not (similar t t') then
         raise
           (Util.Transient
              (Format.sprintf

Modified: trunk/src/recon.ml
===================================================================
--- trunk/src/recon.ml	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/recon.ml	2010-02-17 13:06:38 UTC (rev 410)
@@ -157,7 +157,7 @@
     ("",`Prefer)
 
 let noDeletion =
-  Prefs.createStringList "nodeletion" ~local:true
+  Prefs.createStringList "nodeletion"
     "prevent file deletions on one replica"
     ("Including the preference \\texttt{-nodeletion \\ARG{root}} prevents \
       Unison from performing any file deletion on root \\ARG{root}.\n\n\
@@ -165,7 +165,7 @@
       want to prevent any creation.")
 
 let noUpdate =
-  Prefs.createStringList "noupdate" ~local:true
+  Prefs.createStringList "noupdate"
     "prevent file updates and deletions on one replica"
     ("Including the preference \\texttt{-noupdate \\ARG{root}} prevents \
       Unison from performing any file update or deletion on root \
@@ -174,7 +174,7 @@
       want to prevent any update.")
 
 let noCreation =
-  Prefs.createStringList "nocreation" ~local:true
+  Prefs.createStringList "nocreation"
     "prevent file creations on one replica"
     ("Including the preference \\texttt{-nocreation \\ARG{root}} prevents \
       Unison from performing any file creation on root \\ARG{root}.\n\n\
@@ -182,7 +182,7 @@
       want to prevent any creation.")
 
 let noDeletionPartial =
-  Pred.create "nodeletionpartial" ~local:true ~advanced:true
+  Pred.create "nodeletionpartial" ~advanced:true
     ("Including the preference \
       \\texttt{nodeletionpartial = \\ARG{PATHSPEC} -> \\ARG{root}} prevents \
       Unison from performing any file deletion in \\ARG{PATHSPEC} \
@@ -190,7 +190,7 @@
       for more information).")
 
 let noUpdatePartial =
-  Pred.create "noupdatepartial" ~local:true ~advanced:true
+  Pred.create "noupdatepartial" ~advanced:true
     ("Including the preference \
       \\texttt{noupdatepartial = \\ARG{PATHSPEC} -> \\ARG{root}} prevents \
       Unison from performing any file update or deletion in \
@@ -198,7 +198,7 @@
       \\sectionref{pathspec}{Path Specification} for more information).")
 
 let noCreationPartial =
-  Pred.create "nocreationpartial" ~local:true ~advanced:true
+  Pred.create "nocreationpartial" ~advanced:true
     ("Including the preference \
       \\texttt{nocreationpartial = \\ARG{PATHSPEC} ->  \\ARG{root}} prevents \
       Unison from performing any file creation in \\ARG{PATHSPEC} \

Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml	2010-02-17 12:27:50 UTC (rev 409)
+++ trunk/src/update.ml	2010-02-17 13:06:38 UTC (rev 410)
@@ -32,8 +32,6 @@
    archive changes: old archives will then automatically be discarded.  (We
    do not use the unison version number for this because usually the archive
    representation does not change between unison versions.) *)
-(*FIX: Use similar_correct in props.ml next time the
-  format is modified (see file props.ml for the new function) *)
 (*FIX: also change Fileinfo.stamp to drop the info.ctime component, next
   time the format is modified *)
 (*FIX: also make Jerome's suggested change about file times (see his mesg in



More information about the Unison-hackers mailing list