[Unison-hackers] [unison-svn] r347 - in branches/2.27/src: . lwt win32rc

vouillon@seas.upenn.edu vouillon at seas.upenn.edu
Fri May 29 11:30:21 EDT 2009


Author: vouillon
Date: 2009-05-29 11:30:16 -0400 (Fri, 29 May 2009)
New Revision: 347

Modified:
   branches/2.27/src/RECENTNEWS
   branches/2.27/src/case.ml
   branches/2.27/src/case.mli
   branches/2.27/src/lwt/lwt_unix.ml
   branches/2.27/src/mkProjectInfo.ml
   branches/2.27/src/props.ml
   branches/2.27/src/uicommon.ml
   branches/2.27/src/update.ml
   branches/2.27/src/win32rc/U.ico
   branches/2.27/src/win32rc/unison.rc
   branches/2.27/src/win32rc/unison.res
   branches/2.27/src/win32rc/unison.res.lib
Log:
Backport to stable release:
* Ignore one hour differences for deciding whether a file may have
  been updated.  This avoids slow update detection after daylight
  saving time changes under Windows.  This makes it slightly more
  likely to miss an update, but that should be safe enough.
* Improved Unison icon under Windows
* Fixed quotation of paths and names when writing to a preference file
* Case sensitivity information put in the archive (in a backward
  compatible way) and checked when the archive is loaded
* Uses improved emulation of "select" call provided by Ocaml 3.11
  under Windows (the GUI does not freeze as much during synchronization)


Modified: branches/2.27/src/RECENTNEWS
===================================================================
--- branches/2.27/src/RECENTNEWS	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/RECENTNEWS	2009-05-29 15:30:16 UTC (rev 347)
@@ -1,3 +1,18 @@
+CHANGES FROM VERSION 2.27.109
+
+Backport to stable release:
+* Ignore one hour differences for deciding whether a file may have
+  been updated.  This avoids slow update detection after daylight
+  saving time changes under Windows.  This makes it slightly more
+  likely to miss an update, but that should be safe enough.
+* Improved Unison icon under Windows
+* Fixed quotation of paths and names when writing to a preference file
+* Case sensitivity information put in the archive (in a backward
+  compatible way) and checked when the archive is loaded
+* Uses improved emulation of "select" call provided by Ocaml 3.11
+  under Windows (the GUI does not freeze as much during synchronization)
+
+-------------------------------
 CHANGES FROM VERSION 2.27.101
 
 * Applied a patch from Karl M to make the GTK2 version build with

Modified: branches/2.27/src/case.ml
===================================================================
--- branches/2.27/src/case.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/case.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -28,6 +28,9 @@
 (* Note: this function must be fast *)
 let insensitive () = Prefs.read someHostIsInsensitive
 
+let modeDescription () =
+  if insensitive () then "Latin-1 case insensitive" else "case sensitive"
+
 let needNormalization s =
   let rec iter s pos len wasDot =
     if pos = len then wasDot else

Modified: branches/2.27/src/case.mli
===================================================================
--- branches/2.27/src/case.mli	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/case.mli	2009-05-29 15:30:16 UTC (rev 347)
@@ -2,6 +2,7 @@
 (* Copyright 1999-2007 (see COPYING for details) *)
 
 val insensitive : unit -> bool
+val modeDescription : unit -> string
 
 val normalize : string -> string
 

Modified: branches/2.27/src/lwt/lwt_unix.ml
===================================================================
--- branches/2.27/src/lwt/lwt_unix.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/lwt/lwt_unix.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -14,6 +14,9 @@
 - [connect] is blocking
 *)
 let windows_hack = Sys.os_type <> "Unix"
+let recent_ocaml =
+  Scanf.sscanf Sys.ocaml_version "%d.%d"
+    (fun maj min -> (maj = 3 && min >= 11) || maj > 3)
 
 module SleepQueue =
   Pqueue.Make (struct
@@ -112,7 +115,7 @@
       let infds = List.map fst !inputs in
       let outfds = List.map fst !outputs in
       let (readers, writers, _) =
-        if windows_hack then
+        if windows_hack && not recent_ocaml then
           let writers = outfds in
           let readers =
             if delay = 0. || writers <> [] then [] else infds in
@@ -129,6 +132,11 @@
               ([], [], [])
           | Unix.Unix_error (Unix.EBADF, _, _) ->
               (List.filter bad_fd infds, List.filter bad_fd outfds, [])
+          | Unix.Unix_error (Unix.EPIPE, _, _)
+            when windows_hack && recent_ocaml ->
+            (* Workaround for a bug in Ocaml 3.11: select fails with an
+               EPIPE error when the file descriptor is remotely closed *)
+              (infds, [], [])
       in
       restart_threads !event_counter now;
       List.iter

Modified: branches/2.27/src/mkProjectInfo.ml
===================================================================
--- branches/2.27/src/mkProjectInfo.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/mkProjectInfo.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -78,3 +78,4 @@
 
 
 
+

Modified: branches/2.27/src/props.ml
===================================================================
--- branches/2.27/src/props.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/props.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -525,8 +525,11 @@
    we have to compare then using "similar". *)
 let same p p' =
   match p, p' with
-    Synced _, Synced _ -> similar p p'
-  | _                  -> extract p = extract p'
+    Synced _, Synced _ ->
+      similar p p'
+  | _                  ->
+      let delta = extract p -. extract p' in
+      delta = 0. || delta = 3600. || delta = -3600.
 
 let init _ = ()
 

Modified: branches/2.27/src/uicommon.ml
===================================================================
--- branches/2.27/src/uicommon.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/uicommon.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -344,7 +344,7 @@
   let pos = ref 0 in
   for i = 0 to len - 1 do
     match s.[i] with
-      '*' | '?' | '[' | '{' as c ->
+      '*' | '?' | '[' | '{' | '}' | ',' | '\\' as c ->
         buf.[!pos] <- '\\'; buf.[!pos + 1] <- c; pos := !pos + 2
     | c ->
         buf.[!pos] <- c; pos := !pos + 1

Modified: branches/2.27/src/update.ml
===================================================================
--- branches/2.27/src/update.ml	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/update.ml	2009-05-29 15:30:16 UTC (rev 347)
@@ -229,6 +229,54 @@
     h::r -> h <> None && Safelist.for_all (fun h' -> h = h') r
   | _    -> true
 
+let (archiveNameOnRoot
+       : Common.root ->  archiveVersion -> (string * string * bool) Lwt.t)
+    =
+  Remote.registerRootCmd
+    "archiveName"
+      (fun (fspath, v) ->
+       let (name,_) = archiveName fspath v in
+       Lwt.return
+         (name,
+          Os.myCanonicalHostName,
+          Sys.file_exists (Fspath.toString (Os.fileInUnisonDir name))))
+
+let checkArchiveCaseSensitivity l =
+  match l with
+    Some (_, magic) :: _ ->
+      begin try
+        let archMode = String.sub magic 0 (String.index magic '\000') in
+        let curMode = Case.modeDescription () in
+        if curMode <> archMode then begin
+          (* We cannot compute the archive name locally as it
+             currently depends on the os type *)
+          Globals.allRootsMap
+            (fun r -> archiveNameOnRoot r MainArch) >>= fun names ->
+          let l =
+            List.map
+              (fun (name, host, _) ->
+                 Format.sprintf "    archive %s on host %s" name host)
+              names
+          in
+          Lwt.fail
+            (Util.Fatal
+               (String.concat "\n"
+                  ("Warning: incompatible case sensitivity settings." ::
+                    Format.sprintf "Unison is currently in %s mode," curMode ::
+                    Format.sprintf
+                      "while the archives assume %s mode." archMode ::
+                    "You should either change Unison's setup " ::
+                    "or delete the following archives:" ::
+                    l @
+                    ["Then, try again."])))
+        end else
+          Lwt.return ()
+      with Not_found ->
+        Lwt.return ()
+      end
+  | _ ->
+      Lwt.return ()
+
 (*****************************************************************************)
 (*                      LOADING AND SAVING ARCHIVES                          *)
 (*****************************************************************************)
@@ -301,8 +349,10 @@
    output_string c "\n";
    output_string c (verboseArchiveName thisRoot);
    output_string c "\n";
-   output_string c (Printf.sprintf "Written at %s\n"
-                      (Util.time2string (Util.time())));
+   (* This third line is purely informative *)
+   output_string c (Printf.sprintf "Written at %s - %s mode\n"
+                      (Util.time2string (Util.time()))
+                      (Case.modeDescription ()));
    Marshal.to_channel c (archive, hash, magic) [Marshal.No_sharing];
    close_out c)
 
@@ -536,6 +586,7 @@
       ^ "       arXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"
       ^ "     where the X's are a hexidecimal number .\n"
       ^ "  c) Run unison again to synchronize from scratch.\n"));
+  checkArchiveCaseSensitivity checksums >>= fun () ->
   if Prefs.read dumpArchives then 
     Globals.allRootsMap (fun r -> dumpArchiveOnRoot r ())
      >>= (fun _ -> Lwt.return identicals)
@@ -732,18 +783,6 @@
          Sys.file_exists (Fspath.toString (Os.fileInUnisonDir newname)) in
        Lwt.return (oldexists, newexists))
 
-let (archiveNameOnRoot
-       : Common.root ->  archiveVersion -> (string * string * bool) Lwt.t)
-    =
-  Remote.registerRootCmd
-    "archiveName"
-      (fun (fspath, v) ->
-       let (name,_) = archiveName fspath v in
-       Lwt.return
-         (name,
-          Os.myCanonicalHostName,
-          Sys.file_exists (Fspath.toString (Os.fileInUnisonDir name))))
-
 let forall = Safelist.for_all (fun x -> x)
 let exists = Safelist.exists (fun x -> x)
 
@@ -1556,7 +1595,8 @@
      Remote.Thread.unwindProtect
        (fun () ->
           let magic =
-            Format.sprintf "%.f.%d" (Unix.gettimeofday ()) (Unix.getpid ())
+            Format.sprintf "%s\000%.f.%d"
+              (Case.modeDescription ()) (Unix.gettimeofday ()) (Unix.getpid ())
           in
           Globals.allRootsMap (fun r -> prepareCommitOnRoot r magic)
             >>= (fun checksums ->

Modified: branches/2.27/src/win32rc/U.ico
===================================================================
(Binary files differ)

Modified: branches/2.27/src/win32rc/unison.rc
===================================================================
--- branches/2.27/src/win32rc/unison.rc	2009-05-29 14:00:18 UTC (rev 346)
+++ branches/2.27/src/win32rc/unison.rc	2009-05-29 15:30:16 UTC (rev 347)
@@ -1,80 +1,3 @@
 #include <winver.h>
 
 UNISON_ICON		ICON			"U.ico"
-X_cursor                CURSOR  DISCARDABLE     "cursor00.cur"
-arrow                   CURSOR  DISCARDABLE     "cursor02.cur"
-based_arrow_down        CURSOR  DISCARDABLE     "cursor04.cur"
-based_arrow_up          CURSOR  DISCARDABLE     "cursor06.cur"
-boat                    CURSOR  DISCARDABLE     "cursor08.cur"
-bogosity                CURSOR  DISCARDABLE     "cursor0a.cur"
-bottom_left_corner      CURSOR  DISCARDABLE     "cursor0c.cur"
-bottom_right_corner     CURSOR  DISCARDABLE     "cursor0e.cur"
-bottom_side             CURSOR  DISCARDABLE     "cursor10.cur"
-bottom_tee              CURSOR  DISCARDABLE     "cursor12.cur"
-box_spiral              CURSOR  DISCARDABLE     "cursor14.cur"
-center_ptr              CURSOR  DISCARDABLE     "cursor16.cur"
-circle                  CURSOR  DISCARDABLE     "cursor18.cur"
-clock                   CURSOR  DISCARDABLE     "cursor1a.cur"
-coffee_mug              CURSOR  DISCARDABLE     "cursor1c.cur"
-cross                   CURSOR  DISCARDABLE     "cursor1e.cur"
-cross_reverse           CURSOR  DISCARDABLE     "cursor20.cur"
-crosshair               CURSOR  DISCARDABLE     "cursor22.cur"
-diamond_cross           CURSOR  DISCARDABLE     "cursor24.cur"
-dot                     CURSOR  DISCARDABLE     "cursor26.cur"
-dotbox                  CURSOR  DISCARDABLE     "cursor28.cur"
-double_arrow            CURSOR  DISCARDABLE     "cursor2a.cur"
-draft_large             CURSOR  DISCARDABLE     "cursor2c.cur"
-draft_small             CURSOR  DISCARDABLE     "cursor2e.cur"
-draped_box              CURSOR  DISCARDABLE     "cursor30.cur"
-exchange                CURSOR  DISCARDABLE     "cursor32.cur"
-fleur                   CURSOR  DISCARDABLE     "cursor34.cur"
-gobbler                 CURSOR  DISCARDABLE     "cursor36.cur"
-gumby                   CURSOR  DISCARDABLE     "cursor38.cur"
-hand1                   CURSOR  DISCARDABLE     "cursor3a.cur"
-hand2                   CURSOR  DISCARDABLE     "cursor3c.cur"
-heart                   CURSOR  DISCARDABLE     "cursor3e.cur"
-icon                    CURSOR  DISCARDABLE     "cursor40.cur"
-iron_cross              CURSOR  DISCARDABLE     "cursor42.cur"
-left_ptr                CURSOR  DISCARDABLE     "cursor44.cur"
-left_side               CURSOR  DISCARDABLE     "cursor46.cur"
-left_tee                CURSOR  DISCARDABLE     "cursor48.cur"
-leftbutton              CURSOR  DISCARDABLE     "cursor4a.cur"
-ll_angle                CURSOR  DISCARDABLE     "cursor4c.cur"
-lr_angle                CURSOR  DISCARDABLE     "cursor4e.cur"
-man                     CURSOR  DISCARDABLE     "cursor50.cur"
-middlebutton            CURSOR  DISCARDABLE     "cursor52.cur"
-mouse                   CURSOR  DISCARDABLE     "cursor54.cur"
-pencil                  CURSOR  DISCARDABLE     "cursor56.cur"
-pirate                  CURSOR  DISCARDABLE     "cursor58.cur"
-plus                    CURSOR  DISCARDABLE     "cursor5a.cur"
-question_arrow          CURSOR  DISCARDABLE     "cursor5c.cur"
-right_ptr               CURSOR  DISCARDABLE     "cursor5e.cur"
-right_side              CURSOR  DISCARDABLE     "cursor60.cur"
-right_tee               CURSOR  DISCARDABLE     "cursor62.cur"
-rightbutton             CURSOR  DISCARDABLE     "cursor64.cur"
-rtl_logo                CURSOR  DISCARDABLE     "cursor66.cur"
-sailboat                CURSOR  DISCARDABLE     "cursor68.cur"
-sb_down_arrow           CURSOR  DISCARDABLE     "cursor6a.cur"
-sb_h_double_arrow       CURSOR  DISCARDABLE     "cursor6c.cur"
-sb_left_arrow           CURSOR  DISCARDABLE     "cursor6e.cur"
-sb_right_arrow          CURSOR  DISCARDABLE     "cursor70.cur"
-sb_up_arrow             CURSOR  DISCARDABLE     "cursor72.cur"
-sb_v_double_arrow       CURSOR  DISCARDABLE     "cursor74.cur"
-shuttle                 CURSOR  DISCARDABLE     "cursor76.cur"
-sizing                  CURSOR  DISCARDABLE     "cursor78.cur"
-spider                  CURSOR  DISCARDABLE     "cursor7a.cur"
-spraycan                CURSOR  DISCARDABLE     "cursor7c.cur"
-star                    CURSOR  DISCARDABLE     "cursor7e.cur"
-target                  CURSOR  DISCARDABLE     "cursor80.cur"
-tcross                  CURSOR  DISCARDABLE     "cursor82.cur"
-top_left_arrow          CURSOR  DISCARDABLE     "cursor84.cur"
-top_left_corner         CURSOR  DISCARDABLE     "cursor86.cur"
-top_right_corner        CURSOR  DISCARDABLE     "cursor88.cur"
-top_side                CURSOR  DISCARDABLE     "cursor8a.cur"
-top_tee                 CURSOR  DISCARDABLE     "cursor8c.cur"
-trek                    CURSOR  DISCARDABLE     "cursor8e.cur"
-ul_angle                CURSOR  DISCARDABLE     "cursor90.cur"
-umbrella                CURSOR  DISCARDABLE     "cursor92.cur"
-ur_angle                CURSOR  DISCARDABLE     "cursor94.cur"
-xterm                   CURSOR  DISCARDABLE     "cursor98.cur"
-watch                   CURSOR  DISCARDABLE     "cursor96.cur"

Modified: branches/2.27/src/win32rc/unison.res
===================================================================
(Binary files differ)

Modified: branches/2.27/src/win32rc/unison.res.lib
===================================================================
(Binary files differ)



More information about the Unison-hackers mailing list