[Unison-hackers] [unison-svn] r381 - in trunk/src: . system system/generic system/win
vouillon@seas.upenn.edu
vouillon at seas.upenn.edu
Wed Jul 29 10:34:18 EDT 2009
Author: vouillon
Date: 2009-07-29 10:34:18 -0400 (Wed, 29 Jul 2009)
New Revision: 381
Modified:
trunk/src/.depend
trunk/src/RECENTNEWS
trunk/src/fileinfo.ml
trunk/src/fs.ml
trunk/src/fs.mli
trunk/src/mkProjectInfo.ml
trunk/src/props.ml
trunk/src/remote.ml
trunk/src/system/generic/system_impl.ml
trunk/src/system/system_generic.ml
trunk/src/system/system_intf.ml
trunk/src/system/system_win.ml
trunk/src/system/system_win_stubs.c
trunk/src/system/win/system_impl.ml
trunk/src/transfer.ml
trunk/src/uicommon.ml
trunk/src/uigtk2.ml
trunk/src/update.ml
Log:
* Disabled the new directory fast check optimization under Windows, as
Windows does not update the directory modification time when a
directory contents changes on a FAT filesystem.
* Use inode numbers in fast check mode when using the Windows Unicode
API or Cygwin
* Do not print the "Connected [...]" message when both replicas are local
Modified: trunk/src/.depend
===================================================================
--- trunk/src/.depend 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/.depend 2009-07-29 14:34:18 UTC (rev 381)
@@ -23,7 +23,7 @@
path.cmi: pred.cmi name.cmi
pred.cmi:
props.cmi: uutil.cmi ubase/prefs.cmi path.cmi osx.cmi fspath.cmi
-recon.cmi: path.cmi common.cmi
+recon.cmi: props.cmi path.cmi common.cmi
remote.cmi: ubase/prefs.cmi lwt/lwt.cmi fspath.cmi common.cmi clroot.cmi \
bytearray.cmi
sortri.cmi: common.cmi
@@ -44,8 +44,7 @@
update.cmi: uutil.cmi tree.cmi props.cmi path.cmi osx.cmi os.cmi name.cmi \
lwt/lwt.cmi fspath.cmi fileinfo.cmi common.cmi
uutil.cmi:
-xferhint.cmi: props.cmi ubase/prefs.cmi path.cmi osx.cmi os.cmi fspath.cmi \
- fileinfo.cmi
+xferhint.cmi: ubase/prefs.cmi path.cmi os.cmi fspath.cmi
abort.cmo: uutil.cmi ubase/util.cmi ubase/trace.cmi ubase/prefs.cmi abort.cmi
abort.cmx: uutil.cmx ubase/util.cmx ubase/trace.cmx ubase/prefs.cmx abort.cmi
bytearray.cmo: bytearray.cmi
@@ -94,8 +93,8 @@
fileutil.cmx: fileutil.cmi
fingerprint.cmo: uutil.cmi ubase/util.cmi fspath.cmi fs.cmi fingerprint.cmi
fingerprint.cmx: uutil.cmx ubase/util.cmx fspath.cmx fs.cmx fingerprint.cmi
-fs.cmo: ubase/util.cmi fspath.cmi fs.cmi
-fs.cmx: ubase/util.cmx fspath.cmx fs.cmi
+fs.cmo: fspath.cmi fs.cmi
+fs.cmx: fspath.cmx fs.cmi
fspath.cmo: uutil.cmi ubase/util.cmi system.cmi ubase/rx.cmi path.cmi \
name.cmi fileutil.cmi fspath.cmi
fspath.cmx: uutil.cmx ubase/util.cmx system.cmx ubase/rx.cmx path.cmx \
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/RECENTNEWS 2009-07-29 14:34:18 UTC (rev 381)
@@ -1,5 +1,15 @@
CHANGES FROM VERSION 2.37.1
+* Disabled the new directory fast check optimization under Windows, as
+ Windows does not update the directory modification time when a
+ directory contents changes on a FAT filesystem.
+* Use inode numbers in fast check mode when using the Windows Unicode
+ API or Cygwin
+* Do not print the "Connected [...]" message when both replicas are local
+
+-------------------------------
+CHANGES FROM VERSION 2.37.1
+
* Bumped version number: incompatible protocol changes
* Create parent directories (with correct permissions) during
Modified: trunk/src/fileinfo.ml
===================================================================
--- trunk/src/fileinfo.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/fileinfo.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -149,7 +149,7 @@
fastcheck expects ctime to be preserved by renaming. Thus, we should
probably not use any stamp under Windows. *)
-let pretendLocalOSIsWin32 =
+let ignoreInodeNumbers =
Prefs.createBool "ignoreinodenumbers" false
"!Use creation times for detecting updates"
("When set to true, this preference makes Unison not take advantage \
@@ -159,15 +159,13 @@
can be useful for synchronizing VFAT filesystems (which do not \
support inode numbers) mounted on Unix systems. \
The {\\tt fastcheck} option should also be set to true.")
-let _ = Prefs.alias pretendLocalOSIsWin32 "pretendwin"
+let _ = Prefs.alias ignoreInodeNumbers "pretendwin"
let stamp info =
(* Was "CtimeStamp info.ctime", but this is bogus: Windows
ctimes are not reliable. *)
- if Prefs.read pretendLocalOSIsWin32 then CtimeStamp 0.0 else
- match Util.osType with
- `Unix -> InodeStamp info.inode
- | `Win32 -> CtimeStamp 0.0
+ if Prefs.read ignoreInodeNumbers then CtimeStamp 0.0 else
+ if Fs.hasInodeNumbers () then InodeStamp info.inode else CtimeStamp 0.0
let ressStamp info = Osx.stamp info.osX
Modified: trunk/src/fs.ml
===================================================================
--- trunk/src/fs.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/fs.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -74,7 +74,7 @@
close_in ic;
d
-let canSetTime f =
- System.canSetTime (Util.osType <> `Win32) (Fspath.toString f)
+let canSetTime f = System.canSetTime (Fspath.toString f)
+let hasInodeNumbers () = System.hasInodeNumbers ()
let setUnicodeEncoding = System.setUnicodeEncoding
Modified: trunk/src/fs.mli
===================================================================
--- trunk/src/fs.mli 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/fs.mli 2009-07-29 14:34:18 UTC (rev 381)
@@ -6,6 +6,5 @@
include System_intf.Core with type fspath = Fspath.t
val digestFile : Fspath.t -> string
-val canSetTime : Fspath.t -> bool
val setUnicodeEncoding : bool -> unit
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/mkProjectInfo.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -97,3 +97,4 @@
+
Modified: trunk/src/props.ml
===================================================================
--- trunk/src/props.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/props.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -227,7 +227,7 @@
(Fspath.toPrintString (Fspath.concat fspath path))
(syncedPartsToString (fp, mask))
(syncedPartsToString (fp', mask))
- (mask land (lnot (fp lxor fp')))))
+ ((Prefs.read permMask) land (lnot (fp lxor fp')))))
let init someHostIsRunningWindows =
let mask = if someHostIsRunningWindows then wind_mask else unix_mask in
Modified: trunk/src/remote.ml
===================================================================
--- trunk/src/remote.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/remote.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -34,10 +34,20 @@
(fun maj min -> (maj = 3 && min >= 11) || maj > 3)
(*
- Flow-control mechanism (only active under windows).
+ Flow-control mechanism (only active under Windows).
Only one side is allowed to send messages at any given time.
Once it has finished sending messages, a special message is sent
meaning that the destination is now allowed to send messages.
+
+ Threads behave in a very controlled way: they only perform possibly
+ blocking I/Os through the remote module, and never call
+ Lwt_unix.yield. This mean that when one side gives up its right to
+ write, we know that no longer how much we wait, it would not have
+ any thing to write. This ensures that there will be no deadlock.
+ A more robust protocol would be to give up write permission
+ whenever idle (not just after having sent at least one message).
+ But then, there is the risk that the two sides exchange spurious
+ messages.
*)
let needFlowControl = windowsHack
let readOrWrite = needFlowControl && not recent_ocaml
Modified: trunk/src/system/generic/system_impl.ml
===================================================================
--- trunk/src/system/generic/system_impl.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/generic/system_impl.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -19,13 +19,5 @@
module Fs = struct
include System_generic
- let canSetTime win f =
- not win ||
- try
- Unix.access f [Unix.W_OK];
- true
- with
- Unix.Unix_error _ -> false
-
let setUnicodeEncoding _ = ()
end
Modified: trunk/src/system/system_generic.ml
===================================================================
--- trunk/src/system/system_generic.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/system_generic.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -71,3 +71,19 @@
let close_process_in = Unix.close_process_in
let close_process_out = Unix.close_process_out
let close_process_full = Unix.close_process_full
+
+(****)
+
+let isNotWindows = Sys.os_type <> "Win32"
+
+let canSetTime f =
+ isNotWindows ||
+ try
+ Unix.access f [Unix.W_OK];
+ true
+ with
+ Unix.Unix_error _ -> false
+
+(* Note that Cygwin provides some kind of inode numbers, but we only
+ have access to the lower 32 bits on 32bit systems... *)
+let hasInodeNumbers () = isNotWindows
Modified: trunk/src/system/system_intf.ml
===================================================================
--- trunk/src/system/system_intf.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/system_intf.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -43,6 +43,12 @@
val open_in_bin : fspath -> in_channel
val file_exists : fspath -> bool
+(****)
+
+
+val canSetTime : fspath -> bool
+val hasInodeNumbers : unit -> bool
+
end
module type Full = sig
Modified: trunk/src/system/system_win.ml
===================================================================
--- trunk/src/system/system_win.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/system_win.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -279,3 +279,12 @@
(Process_full(inchan, outchan, errchan)) in
close_in inchan; close_out outchan; close_in errchan;
snd(Unix.waitpid [] pid)
+
+(****)
+
+(* The new implementation of utimes does not have the limitation of
+ the standard one *)
+let canSetTime f = true
+
+(* We provide some kind of inode numbers *)
+let hasInodeNumbers () = true
Modified: trunk/src/system/system_win_stubs.c
===================================================================
--- trunk/src/system/system_win_stubs.c 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/system_win_stubs.c 2009-07-29 14:34:18 UTC (rev 381)
@@ -281,8 +281,11 @@
v = caml_alloc (12, 0);
Store_field (v, 0, Val_int (info.dwVolumeSerialNumber));
+ /* The ocaml code truncates inode numbers to 31 bits. We hash the
+ low and high parts in order to lose as little information as
+ possible. */
Store_field
- (v, 1, Val_int (MAKEDWORDLONG(info.nFileIndexLow,info.nFileIndexHigh)));
+ (v, 1, Val_int (MAKEDWORDLONG(info.nFileIndexLow,info.nFileIndexHigh)+155825701*((DWORDLONG)info.nFileIndexHigh)));
Store_field
(v, 2, Val_int (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
? 1: 0));
@@ -292,7 +295,7 @@
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
mode |= 0000222;
Store_field (v, 3, Val_int(mode));
- Store_field (v, 4, Val_int (1));
+ Store_field (v, 4, Val_int (info.nNumberOfLinks));
Store_field (v, 5, Val_int (0));
Store_field (v, 6, Val_int (0));
Store_field (v, 7, Val_int (0));
Modified: trunk/src/system/win/system_impl.ml
===================================================================
--- trunk/src/system/win/system_impl.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/system/win/system_impl.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -18,9 +18,6 @@
module System = System_win
module Fs = struct
- (* The new implementation of utimes does not have the limitation of
- the standard one *)
- let canSetTime win f = true
let unicode = ref false
@@ -60,4 +57,7 @@
let getcwd v = c1 W.getcwd G.getcwd v
let chdir v = c1 W.chdir G.chdir v
let readlink v = c1 W.readlink G.readlink v
+
+ let canSetTime v = c1 W.canSetTime G.canSetTime v
+ let hasInodeNumbers v = c1 W.hasInodeNumbers G.hasInodeNumbers v
end
Modified: trunk/src/transfer.ml
===================================================================
--- trunk/src/transfer.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/transfer.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -320,6 +320,8 @@
let weakLen = 31.
This would save almost 3 bytes per block, but one need to be able
to recover from an rsync error.
+ (We would have to take into account that our weak checksum is
+ only 31 bits.)
*)
(* Block size *)
let computeBlockSize l = truncate (max 700. (min (sqrt l) 131072.))
Modified: trunk/src/uicommon.ml
===================================================================
--- trunk/src/uicommon.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/uicommon.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -582,7 +582,9 @@
Update.storeRootsName ();
- if not (Prefs.read contactquietly || Prefs.read Trace.terse) then
+ if
+ numRemote > 0 && not (Prefs.read contactquietly || Prefs.read Trace.terse)
+ then
Util.msg "Connected [%s]\n"
(Util.replacesubstring (Update.getRootsName()) ", " " -> ");
Modified: trunk/src/uigtk2.ml
===================================================================
--- trunk/src/uigtk2.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/uigtk2.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -1652,7 +1652,7 @@
let redisplay i =
let (r1, action, r2, status, path) = columnsOf i in
- mainWindow#freeze ();
+ (*mainWindow#freeze ();*)
mainWindow#set_cell ~text:r1 i 0;
displayArrow i i action;
mainWindow#set_cell ~text:r2 i 2;
@@ -1662,7 +1662,7 @@
mainWindow#set_cell
~text:(transcodeFilename path ^
" [failed: click on this line for details]") i 4;
- mainWindow#thaw ();
+ (*mainWindow#thaw ();*)
if !current = Some i then updateDetails ();
updateButtons () in
Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml 2009-07-21 13:10:32 UTC (rev 380)
+++ trunk/src/update.ml 2009-07-29 14:34:18 UTC (rev 381)
@@ -1150,6 +1150,11 @@
Props.dirMarkedUnchanged archDesc fastCheckInfos.dirStamp inode
&&
Props.same_time info.Fileinfo.desc archDesc
+ &&
+ (* Check the date is meaningful: the root directory of a FAT
+ filesystem does not have modification time, so the time returned
+ by [stat] is usually way in the past. *)
+ Props.time archDesc >= 631152000. (* Jan 1, 1990 *)
(* Check whether a file's permissions have not changed *)
let isPropUnchanged info archiveDesc =
@@ -1551,7 +1556,10 @@
showStatus here;
let fastCheckInfos =
{ fastCheck = useFastChecking ();
- dirFastCheck = useFastChecking ();
+ (* Directory optimization is disabled under Windows,
+ as Windows does not update directory modification times
+ on FAT filesystems. *)
+ dirFastCheck = useFastChecking () && Util.osType = `Unix;
dirStamp = dirStamp }
in
let (arch, ui) =
More information about the Unison-hackers
mailing list