[Unison-hackers] [unison-svn] r344 - in trunk/src: . system
vouillon@seas.upenn.edu
vouillon at seas.upenn.edu
Fri May 29 08:05:30 EDT 2009
Author: vouillon
Date: 2009-05-29 08:05:25 -0400 (Fri, 29 May 2009)
New Revision: 344
Modified:
trunk/src/RECENTNEWS
trunk/src/TODO.txt
trunk/src/case.ml
trunk/src/case.mli
trunk/src/mkProjectInfo.ml
trunk/src/remote.ml
trunk/src/system/system_win.ml
trunk/src/system/system_win_stubs.c
trunk/src/uigtk2.ml
trunk/src/update.ml
Log:
* Case sensitivity information put in the archive (in a backward
compatible way) and checked when the archive is loaded
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/RECENTNEWS 2009-05-29 12:05:25 UTC (rev 344)
@@ -1,5 +1,11 @@
CHANGES FROM VERSION 2.34.0
+* Case sensitivity information put in the archive (in a backward
+ compatible way) and checked when the archive is loaded
+
+-------------------------------
+CHANGES FROM VERSION 2.34.0
+
* Fixed quotation of paths and names when writing to a preference file
* Workaround for bug in new "select" implementation in Ocaml 3.11
(select fails with EPIPE error when monitoring a remotely closed
Modified: trunk/src/TODO.txt
===================================================================
--- trunk/src/TODO.txt 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/TODO.txt 2009-05-29 12:05:25 UTC (rev 344)
@@ -85,9 +85,6 @@
- diagnosis: the merge stuff is not correctly updating the archive in
the event of a partial reconciliation
-**** When deleting a directory, we should *not* skip over Unison temp files
- in the process of listing children
-
*** Un-writeable directories can't be copied.
The 'rename' operation at the end of Files.copy will fail (at least on
OSX) if the path being renamed points to a directory and that directory
@@ -203,10 +200,6 @@
~/bin/, especially considering that ~/bin is the wrong place to do the
install under OSX (it should be ~/Apps or ~/Apps/bin)
-** document the dynamically linked version, as some user already reported
- that it works fine. Also, try to make the statistics window work with
- this version. [This is "under windows," I think.]
-
should strip symbols from binary files in 'make exportnative'
@@ -250,12 +243,6 @@
* SMALL FUNCTIONALITY IMPROVEMENTS
* ================================
-**** When I tell unison to ignore a file whose name has a comma in it,
- then unison adds to the preferences file a line like:
- ignore = Path{this file, has a comma}
- which gets interpreted as "this file" OR " has a comma".
- unison should be escaping that comma and write it as \, instead.
-
**** Please let me say
root = ~/bla
instead of requiring me to give an absolute path to my home dir.
@@ -264,10 +251,6 @@
(This is important for correctness -- if the case-insensitive flag is
set differently on different runs, things can get very confused!)
-**** Use LargeFile (submodule of Unix) instead of standard file commands,
- to avoid problems with huge files
- DONE
-
*** [Marcus Sundman, 2008] Unison can't propagate changes in read-only
folders. The correct way to do it is to temporarily add write
permissions for the user to the folder, then do the changes and then
@@ -298,9 +281,6 @@
- otherwise, put them in a central place if one is given
- Update.incrVersionsOfBackups should not be externally visible
-*** there's an HFS+ aware version of rsync called rsyncx. It should be
- relatively easy to import that functionality into unison.
-
*** Consider altering the socket method, so the server accepts connections
only on a particular address? This would be very useful, because many people
tunnel unison over an OpenVPN Link, and this software works with virtual
@@ -312,10 +292,6 @@
===> Probably *all* output should go to stdout, not stderr (but maybe
we need a switch to recover the current behavior)
-*** for the MSVC version of unison, we should deal with the nonstandard
- semantics regarding read-only files.
- ===> What does that mean??
-
*** If a root resides on a `host' with an ever and unpredictably changing
host name (like a public login cluster with dozens of machines and a
shared file system), listing each possible host name for this root is
@@ -339,9 +315,6 @@
offer to delete them *for* the user, rather than forcing the user to
delete them manually.
-*** improve error reporting when Unison is started with different versions of
- client and server
-
*** A switch to delete files before replication. It's not something I
would have considered doing, and in normal replication, there have
already been pointed out good reasons why Unison works the way it
@@ -381,15 +354,6 @@
** we should reload the current preference file (if it's changed, at least)
when we restart
-** [A good idea for the ssh prompt issue...] I'm not sure why you would
- need a C implementation; you could do the same thing in CAML that expect
- does: allocate a PTY, start up ssh on that, and interact with it. On
- Windows, you can probably do the same with the Win32 console API,
- although I don't see why such an improvement needs to work uniformly
- across all platforms to be useful. [Note that allocating PTYs is not
- very portable, but we could at least try allocating one and see if
- something useful comes back...]
-
** An idea for the interface to the external merge functionality:
created a general mechanism for invoking external functionality...
- in profile, declare a command of the form
@@ -481,16 +445,6 @@
mechanism for getting the list of files from another program (plugin)?
===> needs to be documented (look at rx.ml)
-** seems not to recognise ignores when they are inside a path that has
- just been added.
-===> Jamey claims that if we add a new directory, some of whose children
- are ignored, then when this new dir is propagated, also the ignored
- stuff gets copied (if this is true, then it's probably a bug in
- update.ml)
-
-* When loading archives (not just when dumping them), one should check that
- they have the same checksum.
-
* [July 2002, S. Garfinkel] Maybe we should turn the 'time' option on by
default. We might need to help people a little on the upgrading,
though. When you did a sync with time=false, then a sync with
@@ -544,9 +498,6 @@
messages in the text ui. See Dale Worley's message for a detailed
proposal.
-Make sure that no filesystem check is missing in the transport agent.
- ===> What does this mean?
-
Would be nice to have the Unison log file relative to my home directory,
like this
logfile = ~/.unision/log
@@ -578,10 +529,6 @@
obvious... It should be -limitbysize xxx, where xxx is the size
(preferably in kb, but bytes will do as well).
-Maybe we should use getcwd for canonizing roots under Unix. For some
- systems (Linux, for instance), getcwd succeeds even when some parent
- directory is not readable.
-
[From Yan Seiner]
Can unison modify the (*nix) environment to show the
ip/name/some_other_id of the system making the connection? This would
@@ -706,18 +653,9 @@
Execute rm core If core
Execute make clean If Makefile
-We should put in a preference that forces Unison to do really safe update
- detection (with fingerprinting), even on Unix systems. (Maybe just for
- some paths?)
-
Maybe we should never emit a conflict for modtimes; instead, we just
propagate the largest one.
-[John Langford] Some code for (at least partially) handling large files
- can be found in 64bit_ops.c in:
- http://www-2.cs.cmu.edu/~jcl/programs/sync_file.tar.gz
- Make sure you pay attention to the compile line as it is important.
-
[Ivo Welch] I would do a quick test of case sensitivity in the program
itself at the time you do a first prf sync, so that the user does not have
to bother with it. Just write two files on each end which differ in case,
@@ -865,35 +803,6 @@
("Select an existing profile..."). I think the help topics should be
available here.
-* [Jamey Leifer] The file list is confusing since the paths
- are sometime relative to the root and sometimes relative to the
- previous path:
- Mail/drafts/3
- inbox/5538
- 5539
- 5540
- I now understand that the indentation is significant, but it's not
- that clear. A further confusion is that there's varying amounts of
- indentation depending on the depth of the enclosing path:
- foo/1
- 2
- boo/goo/loo/1
- 3
- 4
- This is really hard to parse since the fonts are variable width.
- I would prefer to read the former as:
- Mail/drafts/3
- inbox/5538
- 5539
- 5540
- (with the indentation actually showing the relationship) though this
- may take too much horizontal space. Alternatively, one could choose a
- Windows-style display:
- |-Mail/drafts/3
- |-inbox/5538
- |- 5539
- |- 5540
-
Unison's gui offers an `Actions' menu with a variety of features
regarding preferences. I would love to see an action with the following
semantics: if the two files differ only in their modification time,
@@ -931,8 +840,6 @@
really want this, probably the best is to put in some preferences for the
user to control the colors of all the arrows individually.
-Under Windows, convert filename to Unicode before printing them.
-
Text mode user interface should be brought up to date with graphical
interface (it should prompt for profile selection, creation, root
entry, etc.; command characters should be the same; ...)
@@ -1099,12 +1006,6 @@
--
PS: see http://www.simplythebest.net/shellenh.html for some examples.
-when typing ctrl-c in windows (dos-window in win98SE) when
- unison is asking for conflicting updates there araises following
- message (sorry for my bad translation to english):
- "This program is closes because of a non-valid action. Contact the
- manufactura if the error remains".
-
NTFS seems to have two ways of setting a file read-only!
Comments from Karl Moerder:
Tonight I made some files read-only on my desktop at home. I did this by
Modified: trunk/src/case.ml
===================================================================
--- trunk/src/case.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/case.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -132,6 +132,7 @@
let sensitiveOps = object
method mode = Sensitive
+ method modeDesc = "case sensitive"
method compare s s' = compare s s'
method hash s = Hashtbl.hash s
method normalizePattern s = s
@@ -142,6 +143,7 @@
let insensitiveOps = object
method mode = Insensitive
+ method modeDesc = "Latin-1 case insensitive"
method compare s s' = Util.nocase_cmp s s'
method hash s = Hashtbl.hash (String.lowercase s)
method normalizePattern s = s
@@ -152,6 +154,7 @@
let unicodeInsensitiveOps = object
method mode = UnicodeInsensitive
+ method modeDesc = "Unicode case insensitive"
method compare s s' = Unicode.compare s s'
method hash s = Hashtbl.hash (Unicode.normalize s)
method normalizePattern p = Unicode.normalize p
Modified: trunk/src/case.mli
===================================================================
--- trunk/src/case.mli 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/case.mli 2009-05-29 12:05:25 UTC (rev 344)
@@ -7,7 +7,7 @@
type mode
val ops : unit ->
- < mode : mode;
+ < mode : mode; modeDesc : string;
compare : string -> string -> int;
hash : string -> int;
normalizePattern : string -> string;
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/mkProjectInfo.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -156,3 +156,4 @@
+
Modified: trunk/src/remote.ml
===================================================================
--- trunk/src/remote.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/remote.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -1229,9 +1229,10 @@
let beAServer () =
begin try
+ let home = System.getenv "HOME" in
Util.convertUnixErrorsToFatal
"changing working directory"
- (fun () -> System.chdir (System.fspathFromString (System.getenv "HOME")))
+ (fun () -> System.chdir (System.fspathFromString home))
with Not_found ->
Util.msg
"Environment variable HOME unbound: \
Modified: trunk/src/system/system_win.ml
===================================================================
--- trunk/src/system/system_win.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/system/system_win.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -17,11 +17,6 @@
(*XXXX
-Backport to stable:
-- Unix.select in lwt_unix (after some testing...)
-- fix to daylight saving changes
-- Proper quoting of path and names
-
- Use SetConsoleOutputCP/SetConsoleCP in text mode ???
http://www.codeproject.com/KB/cpp/unicode_console_output.aspx?display=Print
Modified: trunk/src/system/system_win_stubs.c
===================================================================
--- trunk/src/system/system_win_stubs.c 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/system/system_win_stubs.c 2009-05-29 12:05:25 UTC (rev 344)
@@ -111,6 +111,9 @@
err = GetLastError ();
if ((err == ERROR_SHARING_VIOLATION || err == ERROR_ACCESS_DENIED) &&
t < 1000) {
+ /* The renaming may fail due to an indexer or an anti-virus.
+ We retry after a short time in the hope that this other
+ program is done with the file. */
Sleep (t);
t *= 2;
goto retry;
Modified: trunk/src/uigtk2.ml
===================================================================
--- trunk/src/uigtk2.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/uigtk2.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -591,7 +591,7 @@
ignore (GMisc.label
~markup:(primaryText title ^ "\n\n" ^
escapeMarkup (transcode message))
- ~selectable:true ~yalign:0. ~packing:v1#add ());
+ ~line_wrap:true ~selectable:true ~yalign:0. ~packing:v1#add ());
t#add_button_stock `QUIT `QUIT;
t#set_default_response `QUIT;
grabFocus t; t#show(); ignore (t#run ()); t#destroy (); releaseFocus ();
Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml 2009-05-28 09:23:33 UTC (rev 343)
+++ trunk/src/update.ml 2009-05-29 12:05:25 UTC (rev 344)
@@ -41,6 +41,8 @@
(*FIX: one should also store whether we are in case-insensitive mode
in the archive and check the mode has not changed when the archive
is loaded *)
+(*FIX: consider changing the way case-sensitivity mode is stored in
+ the archive *)
let archiveFormat = 22
module NameMap = MyMap.Make (Name)
@@ -249,6 +251,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,
+ System.file_exists (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.ops ())#modeDesc 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 *)
(*****************************************************************************)
@@ -324,8 +374,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.ops())#modeDesc));
Marshal.to_channel c (archive, hash, magic) [Marshal.No_sharing];
close_out c)
@@ -565,6 +617,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)
@@ -761,18 +814,6 @@
System.file_exists (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,
- System.file_exists (Os.fileInUnisonDir name)))
-
let forall = Safelist.for_all (fun x -> x)
let exists = Safelist.exists (fun x -> x)
@@ -1626,7 +1667,8 @@
Remote.Thread.unwindProtect
(fun () ->
let magic =
- Format.sprintf "%.f.%d" (Unix.gettimeofday ()) (Unix.getpid ())
+ Format.sprintf "%s\000%.f.%d"
+ ((Case.ops ())#modeDesc) (Unix.gettimeofday ()) (Unix.getpid ())
in
Globals.allRootsMap (fun r -> prepareCommitOnRoot r magic)
>>= (fun checksums ->
More information about the Unison-hackers
mailing list