From bcpierce at seas.upenn.edu Sat Nov 8 11:53:42 2008 From: bcpierce at seas.upenn.edu (Benjamin C. Pierce) Date: Sat, 8 Nov 2008 11:53:42 -0500 Subject: [Unison-hackers] [unison-svn] r309 - trunk/src Message-ID: <200811081653.mA8Grgbm008954@yaws.seas.upenn.edu> Author: bcpierce Date: 2008-11-08 11:53:32 -0500 (Sat, 08 Nov 2008) New Revision: 309 Modified: trunk/src/.depend trunk/src/Makefile.OCaml trunk/src/RECENTNEWS trunk/src/TODO.txt trunk/src/copy.ml trunk/src/files.ml trunk/src/mkProjectInfo.ml trunk/src/os.ml trunk/src/os.mli trunk/src/props.ml trunk/src/stasher.ml trunk/src/update.ml Log: * A special hack for Rasmus, who has a special situation that requires the utimes-setting program to run 'setuid root' (and we do not want all of Unison to run setuid, so we just spin off an external utility to do it). This functionality is disabled by default and requires editing the source code (changing 'false' to 'true' on line 496 of props.ml) and recompiling to enable. If there are other people that want it, we can easily make it accessible using a preference instead, but I prefer not to add a preference until someone else requests it, to avoid creating an incompatible version. * Logging tweak. Modified: trunk/src/.depend =================================================================== --- trunk/src/.depend 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/.depend 2008-11-08 16:53:32 UTC (rev 309) @@ -4,7 +4,8 @@ copy.cmi: uutil.cmi props.cmi path.cmi osx.cmi os.cmi lwt/lwt.cmi fspath.cmi \ common.cmi fileinfo.cmi: props.cmi path.cmi osx.cmi fspath.cmi -files.cmi: uutil.cmi props.cmi path.cmi lwt/lwt.cmi common.cmi +files.cmi: uutil.cmi props.cmi path.cmi lwt/lwt_util.cmi lwt/lwt.cmi \ + common.cmi fingerprint.cmi: uutil.cmi path.cmi fspath.cmi fspath.cmi: path.cmi name.cmi globals.cmi: ubase/prefs.cmi path.cmi lwt/lwt.cmi common.cmi @@ -22,8 +23,8 @@ uigtk.cmi: uicommon.cmi uigtk2.cmi: uicommon.cmi uitext.cmi: uicommon.cmi -update.cmi: tree.cmi props.cmi ubase/prefs.cmi path.cmi osx.cmi os.cmi \ - name.cmi lwt/lwt.cmi fspath.cmi fileinfo.cmi common.cmi +update.cmi: tree.cmi props.cmi path.cmi osx.cmi os.cmi name.cmi lwt/lwt.cmi \ + fspath.cmi fileinfo.cmi common.cmi xferhint.cmi: ubase/prefs.cmi path.cmi os.cmi fspath.cmi abort.cmo: uutil.cmi ubase/util.cmi ubase/trace.cmi ubase/safelist.cmi \ abort.cmi @@ -33,20 +34,24 @@ case.cmx: ubase/prefs.cmx case.cmi checksum.cmo: checksum.cmi checksum.cmx: checksum.cmi -clroot.cmo: ubase/rx.cmi ubase/prefs.cmi clroot.cmi -clroot.cmx: ubase/rx.cmx ubase/prefs.cmx clroot.cmi +clroot.cmo: ubase/util.cmi ubase/rx.cmi ubase/prefs.cmi clroot.cmi +clroot.cmx: ubase/util.cmx ubase/rx.cmx ubase/prefs.cmx clroot.cmi common.cmo: uutil.cmi ubase/util.cmi ubase/safelist.cmi props.cmi path.cmi \ osx.cmi os.cmi name.cmi fspath.cmi fileinfo.cmi common.cmi common.cmx: uutil.cmx ubase/util.cmx ubase/safelist.cmx props.cmx path.cmx \ osx.cmx os.cmx name.cmx fspath.cmx fileinfo.cmx common.cmi copy.cmo: xferhint.cmi uutil.cmi ubase/util.cmi transfer.cmi ubase/trace.cmi \ - remote.cmi props.cmi ubase/prefs.cmi path.cmi osx.cmi os.cmi \ - lwt/lwt_util.cmi lwt/lwt.cmi globals.cmi fspath.cmi fileinfo.cmi \ - common.cmi abort.cmi copy.cmi + ubase/safelist.cmi remote.cmi props.cmi ubase/prefs.cmi path.cmi osx.cmi \ + os.cmi lwt/lwt_util.cmi lwt/lwt.cmi globals.cmi fspath.cmi fileinfo.cmi \ + external.cmi common.cmi clroot.cmi abort.cmi copy.cmi copy.cmx: xferhint.cmx uutil.cmx ubase/util.cmx transfer.cmx ubase/trace.cmx \ - remote.cmx props.cmx ubase/prefs.cmx path.cmx osx.cmx os.cmx \ - lwt/lwt_util.cmx lwt/lwt.cmx globals.cmx fspath.cmx fileinfo.cmx \ - common.cmx abort.cmx copy.cmi + ubase/safelist.cmx remote.cmx props.cmx ubase/prefs.cmx path.cmx osx.cmx \ + os.cmx lwt/lwt_util.cmx lwt/lwt.cmx globals.cmx fspath.cmx fileinfo.cmx \ + external.cmx common.cmx clroot.cmx abort.cmx copy.cmi +external.cmo: ubase/util.cmi ubase/safelist.cmi lwt/lwt_util.cmi \ + lwt/lwt_unix.cmi lwt/lwt.cmi external.cmi +external.cmx: ubase/util.cmx ubase/safelist.cmx lwt/lwt_util.cmx \ + lwt/lwt_unix.cmx lwt/lwt.cmx external.cmi fileinfo.cmo: ubase/util.cmi props.cmi ubase/prefs.cmi path.cmi osx.cmi \ fspath.cmi fileinfo.cmi fileinfo.cmx: ubase/util.cmx props.cmx ubase/prefs.cmx path.cmx osx.cmx \ @@ -54,13 +59,13 @@ files.cmo: uutil.cmi ubase/util.cmi update.cmi ubase/trace.cmi stasher.cmi \ ubase/safelist.cmi ubase/rx.cmi remote.cmi props.cmi ubase/prefs.cmi \ path.cmi osx.cmi os.cmi lwt/lwt_util.cmi lwt/lwt_unix.cmi lwt/lwt.cmi \ - globals.cmi fspath.cmi fingerprint.cmi fileinfo.cmi copy.cmi common.cmi \ - abort.cmi files.cmi + globals.cmi fspath.cmi fingerprint.cmi fileinfo.cmi external.cmi copy.cmi \ + common.cmi abort.cmi files.cmi files.cmx: uutil.cmx ubase/util.cmx update.cmx ubase/trace.cmx stasher.cmx \ ubase/safelist.cmx ubase/rx.cmx remote.cmx props.cmx ubase/prefs.cmx \ path.cmx osx.cmx os.cmx lwt/lwt_util.cmx lwt/lwt_unix.cmx lwt/lwt.cmx \ - globals.cmx fspath.cmx fingerprint.cmx fileinfo.cmx copy.cmx common.cmx \ - abort.cmx files.cmi + globals.cmx fspath.cmx fingerprint.cmx fileinfo.cmx external.cmx copy.cmx \ + common.cmx abort.cmx files.cmi fileutil.cmo: fileutil.cmi fileutil.cmx: fileutil.cmi fingerprint.cmo: uutil.cmi ubase/util.cmi fspath.cmi fingerprint.cmi @@ -108,9 +113,9 @@ pred.cmx: ubase/util.cmx ubase/safelist.cmx ubase/rx.cmx ubase/prefs.cmx \ case.cmx pred.cmi props.cmo: uutil.cmi ubase/util.cmi ubase/prefs.cmi path.cmi osx.cmi \ - fspath.cmi props.cmi + fspath.cmi external.cmi props.cmi props.cmx: uutil.cmx ubase/util.cmx ubase/prefs.cmx path.cmx osx.cmx \ - fspath.cmx props.cmi + fspath.cmx external.cmx props.cmi recon.cmo: ubase/util.cmi update.cmi tree.cmi ubase/trace.cmi sortri.cmi \ ubase/safelist.cmi props.cmi ubase/prefs.cmi pred.cmi path.cmi name.cmi \ globals.cmi fileinfo.cmi common.cmi recon.cmi @@ -203,26 +208,36 @@ ubase/safelist.cmx remote.cmx recon.cmx ubase/prefs.cmx path.cmx os.cmx \ main.cmx lwt/lwt_util.cmx lwt/lwt_unix.cmx lwt/lwt.cmx globals.cmx \ fspath.cmx files.cmx common.cmx clroot.cmx +uimacbridgenew.cmo: xferhint.cmi uutil.cmi ubase/util.cmi update.cmi \ + uicommon.cmi transport.cmi ubase/trace.cmi terminal.cmi stasher.cmi \ + ubase/safelist.cmi remote.cmi recon.cmi ubase/prefs.cmi path.cmi os.cmi \ + main.cmo lwt/lwt_util.cmi lwt/lwt_unix.cmi lwt/lwt.cmi globals.cmi \ + fspath.cmi files.cmi common.cmi clroot.cmi +uimacbridgenew.cmx: xferhint.cmx uutil.cmx ubase/util.cmx update.cmx \ + uicommon.cmx transport.cmx ubase/trace.cmx terminal.cmx stasher.cmx \ + ubase/safelist.cmx remote.cmx recon.cmx ubase/prefs.cmx path.cmx os.cmx \ + main.cmx lwt/lwt_util.cmx lwt/lwt_unix.cmx lwt/lwt.cmx globals.cmx \ + fspath.cmx files.cmx common.cmx clroot.cmx uitext.cmo: uutil.cmi ubase/util.cmi update.cmi uicommon.cmi transport.cmi \ - ubase/trace.cmi ubase/safelist.cmi recon.cmi ubase/prefs.cmi path.cmi \ - lwt/lwt_util.cmi lwt/lwt_unix.cmi lwt/lwt.cmi globals.cmi common.cmi \ - uitext.cmi + ubase/trace.cmi ubase/safelist.cmi remote.cmi recon.cmi ubase/prefs.cmi \ + path.cmi lwt/lwt_util.cmi lwt/lwt_unix.cmi lwt/lwt.cmi globals.cmi \ + common.cmi uitext.cmi uitext.cmx: uutil.cmx ubase/util.cmx update.cmx uicommon.cmx transport.cmx \ - ubase/trace.cmx ubase/safelist.cmx recon.cmx ubase/prefs.cmx path.cmx \ - lwt/lwt_util.cmx lwt/lwt_unix.cmx lwt/lwt.cmx globals.cmx common.cmx \ - uitext.cmi + ubase/trace.cmx ubase/safelist.cmx remote.cmx recon.cmx ubase/prefs.cmx \ + path.cmx lwt/lwt_util.cmx lwt/lwt_unix.cmx lwt/lwt.cmx globals.cmx \ + common.cmx uitext.cmi update.cmo: xferhint.cmi uutil.cmi ubase/util.cmi tree.cmi ubase/trace.cmi \ stasher.cmi ubase/safelist.cmi ubase/rx.cmi remote.cmi props.cmi \ ubase/prefs.cmi pred.cmi path.cmi osx.cmi os.cmi name.cmi ubase/myMap.cmi \ lwt/lwt_unix.cmi lwt/lwt.cmi lock.cmi globals.cmi fspath.cmi \ - fingerprint.cmi fileinfo.cmi common.cmi update.cmi + fingerprint.cmi fileinfo.cmi external.cmi common.cmi update.cmi update.cmx: xferhint.cmx uutil.cmx ubase/util.cmx tree.cmx ubase/trace.cmx \ stasher.cmx ubase/safelist.cmx ubase/rx.cmx remote.cmx props.cmx \ ubase/prefs.cmx pred.cmx path.cmx osx.cmx os.cmx name.cmx ubase/myMap.cmx \ lwt/lwt_unix.cmx lwt/lwt.cmx lock.cmx globals.cmx fspath.cmx \ - fingerprint.cmx fileinfo.cmx common.cmx update.cmi -uutil.cmo: ubase/util.cmi ubase/projectInfo.cmo uutil.cmi -uutil.cmx: ubase/util.cmx ubase/projectInfo.cmx uutil.cmi + fingerprint.cmx fileinfo.cmx external.cmx common.cmx update.cmi +uutil.cmo: ubase/util.cmi uutil.cmi +uutil.cmx: ubase/util.cmx uutil.cmi xferhint.cmo: ubase/util.cmi ubase/trace.cmi ubase/prefs.cmi path.cmi os.cmi \ fspath.cmi xferhint.cmi xferhint.cmx: ubase/util.cmx ubase/trace.cmx ubase/prefs.cmx path.cmx os.cmx \ Modified: trunk/src/Makefile.OCaml =================================================================== --- trunk/src/Makefile.OCaml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/Makefile.OCaml 2008-11-08 16:53:32 UTC (rev 309) @@ -172,7 +172,7 @@ \ case.cmo pred.cmo uutil.cmo \ fileutil.cmo name.cmo path.cmo fspath.cmo fingerprint.cmo \ - abort.cmo osx.cmo \ + abort.cmo osx.cmo external.cmo \ props.cmo fileinfo.cmo os.cmo lock.cmo clroot.cmo common.cmo \ tree.cmo checksum.cmo terminal.cmo \ transfer.cmo xferhint.cmo remote.cmo globals.cmo copy.cmo \ Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/RECENTNEWS 2008-11-08 16:53:32 UTC (rev 309) @@ -1,7 +1,57 @@ CHANGES FROM VERSION 2.31.5 +* A special hack for Rasmus, who has a special situation that requires + the utimes-setting program to run 'setuid root' (and we do not want + all of Unison to run setuid, so we just spin off an external utility + to do it). This functionality is disabled by default and requires + editing the source code (changing 'false' to 'true' on line 496 of + props.ml) and recompiling to enable. If there are other people that + want it, we can easily make it accessible using a preference + instead, but I prefer not to add a preference until someone else + requests it, to avoid creating an incompatible version. + +* Logging tweak. + + + +------------------------------- +CHANGES FROM VERSION 2.31.5 + +* A special hack for Rasmus, who has a special situation that requires + the utimes-setting program to run 'setuid root' (and we do not want + all of Unison to run setuid, so we just spin off an external utility + to do it). This functionality is disabled by default and requires + editing the source code (changing 'false' to 'true' on line 496 of + props.ml) and recompiling to enable. If there are other people that + want it, we can easily make it accessible using a preference + instead, but I prefer not to add a preference until someone else + requests it, to avoid creating an incompatible version. + +* Logging tweak. + + + +------------------------------- +CHANGES FROM VERSION 2.31.5 + +* A special hack for Rasmus, who has a special situation that requires + the utimes-setting program to run 'setuid root' (and we do not want + all of Unison to run setuid, so we just spin off an external utility + to do it). This functionality is disabled by default and requires + editing the source code (changing 'false' to 'true' on line 496 of + props.ml) and recompiling to enable. If there are other people that + want it, we can easily make it accessible using a preference + instead, but I prefer not to add a preference until someone else + requests it, to avoid creating an incompatible version. + +* Logging tweak. + + +CHANGES FROM VERSION 2.31.5 + Resizing the update window vertically no longer moves the status label. Fix contributed by Pedro Melo. ------------------------------- + CHANGES FROM VERSION 2.31.4 * Don't ignore files that look like backup files if the {\\tt Modified: trunk/src/TODO.txt =================================================================== --- trunk/src/TODO.txt 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/TODO.txt 2008-11-08 16:53:32 UTC (rev 309) @@ -11,6 +11,13 @@ CURRENT ======= +* Merge issues: + - It would be better to ignore the exit status of the external merge + tool and just look at what files it produced to decide what happened + - The function that runs the external program should not grab stdin / + stdout / stderr if Unison is running with the text UI. + - The confirmation step should offer to display the new merged file. + * Makefile for fstest * Work on the Unison side Modified: trunk/src/copy.ml =================================================================== --- trunk/src/copy.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/copy.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -625,7 +625,7 @@ ^ (Os.quotes fromSpec) ^ " " ^ (Os.quotes toSpec) in Trace.log (Printf.sprintf "%s\n" cmd); - let _,log = Os.runExternalProgram cmd in + let _,log = External.runExternalProgram cmd in debug (fun() -> let l = Util.trimWhitespace log in Util.msg "transferFileUsingExternalCopyprog %s: returned...\n%s%s" @@ -662,8 +662,9 @@ targetExistsOnRoot rootTo rootFrom (`CheckSize (desc,ress), fspathTo, pathTo) >>= (fun b -> if b then begin - Util.msg "%s/%s has already been transferred\n" - (Fspath.toString fspathTo) (Path.toString pathTo); + Trace.log (Printf.sprintf + "%s/%s has already been transferred\n" + (Fspath.toString fspathTo) (Path.toString pathTo)); Lwt.return () (* Check whether we should use an external program to copy the file *) Modified: trunk/src/files.ml =================================================================== --- trunk/src/files.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/files.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -488,7 +488,7 @@ "\"" ^ cmd ^ "\"" else cmd) in - showDiff cmd (Os.readChannelTillEof c); + showDiff cmd (External.readChannelTillEof c); ignore (Unix.close_process_in c) in let (desc1, fp1, ress1, desc2, fp2, ress2) = Common.fileInfos ui1 ui2 in match root1,root2 with @@ -743,7 +743,7 @@ (Os.quotes (Fspath.concatToString workingDirForMerge newarch)) in Trace.log (Printf.sprintf "Merge command: %s\n" cmd); - let returnValue, mergeResultLog = Os.runExternalProgram cmd in + let returnValue, mergeResultLog = External.runExternalProgram cmd in Trace.log (Printf.sprintf "Merge result (%s):\n%s\n" (showStatus returnValue) mergeResultLog); Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/mkProjectInfo.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -92,3 +92,5 @@ + + Modified: trunk/src/os.ml =================================================================== --- trunk/src/os.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/os.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -347,80 +347,3 @@ loop() -(*****************************************************************************) -(* RUNNING EXTERNAL PROGRAMS *) -(*****************************************************************************) - -let (>>=) = Lwt.bind -open Lwt - -let readChannelTillEof c = - let rec loop lines = - try let l = input_line c in - (* Util.msg "%s\n" l; *) - loop (l::lines) - with End_of_file -> lines in - String.concat "\n" (Safelist.rev (loop [])) - -let readChannelTillEof_lwt c = - let rec loop lines = - let lo = - try - Some(Lwt_unix.run (Lwt_unix.input_line c)) - with End_of_file -> None - in - match lo with - Some l -> loop (l :: lines) - | None -> lines - in - String.concat "\n" (Safelist.rev (loop [])) - -let readChannelsTillEof l = - let rec suckitdry lines c = - Lwt.catch - (fun() -> Lwt_unix.input_line c >>= (fun l -> return (Some l))) - (fun e -> match e with End_of_file -> return None | _ -> raise e) - >>= (fun lo -> - match lo with - None -> return lines - | Some l -> suckitdry (l :: lines) c) in - Lwt_util.map - (fun c -> - suckitdry [] c - >>= (fun res -> return (String.concat "\n" (Safelist.rev res)))) - l - -let runExternalProgram cmd = - if Util.osType = `Win32 && not Util.isCygwin then begin - debug (fun()-> Util.msg "Executing external program windows-style\n"); - let c = Unix.open_process_in ("\"" ^ cmd ^ "\"") in - let log = readChannelTillEof c in - let returnValue = Unix.close_process_in c in - let mergeResultLog = - cmd ^ - (if log <> "" then "\n\n" ^ log else "") ^ - (if returnValue <> Unix.WEXITED 0 then - "\n\n" ^ Util.process_status_to_string returnValue - else - "") in - (returnValue,mergeResultLog) - end else Lwt_unix.run ( - Lwt_unix.open_process_full cmd (Unix.environment ()) - >>= (fun (out, ipt, err) -> - readChannelsTillEof [out;err] - >>= (function [logOut;logErr] -> - Lwt_unix.close_process_full (out, ipt, err) - >>= (fun returnValue -> - let logOut = Util.trimWhitespace logOut in - let logErr = Util.trimWhitespace logErr in - return (returnValue, ( - (* cmd - ^ "\n\n" ^ *) - (if logOut = "" || logErr = "" - then logOut ^ logErr - else logOut ^ "\n\n" ^ ("Error Output:" ^ logErr)) - ^ (if returnValue = Unix.WEXITED 0 - then "" - else "\n\n" ^ Util.process_status_to_string returnValue)))) - (* Stop typechechecker from complaining about non-exhaustive pattern above *) - | _ -> assert false))) Modified: trunk/src/os.mli =================================================================== --- trunk/src/os.mli 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/os.mli 2008-11-08 16:53:32 UTC (rev 309) @@ -55,6 +55,4 @@ ((Fspath.t * Path.local) -> (Fspath.t * Path.local) -> unit) -> unit -val readChannelTillEof : in_channel -> string -val runExternalProgram : string -> Unix.process_status * string val quotes : string -> string Modified: trunk/src/props.ml =================================================================== --- trunk/src/props.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/props.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -493,7 +493,26 @@ Unix.utimes abspath v v) (fun()-> Unix.chmod abspath oldPerms) end - else Unix.utimes abspath v v) + else if false then begin + (* A special hack for Rasmus, who has a special situation that + requires the utimes-setting program to run 'setuid root' + (and we do not want all of Unison to run setuid, so we just + spin off an external utility to do it). *) + let time = Unix.localtime v in + let tstr = Printf.sprintf + "%4d%02d%02d%2d%02d.%02d" + (time.Unix.tm_year + 1900) + (time.Unix.tm_mon + 1) + time.Unix.tm_mday + time.Unix.tm_hour + time.Unix.tm_min + time.Unix.tm_sec in + let cmd = "touch -m -a -t " ^ tstr ^ " " ^ abspath in + Util.msg "Running external program to set utimes:\n %s\n" cmd; + let (r,_) = External.runExternalProgram cmd in + if r<>(Unix.WEXITED 0) then raise (Util.Transient "External time-setting command failed") + end else + Unix.utimes abspath v v) | _ -> () Modified: trunk/src/stasher.ml =================================================================== --- trunk/src/stasher.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/stasher.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -63,7 +63,13 @@ ^ " This keyword is ignored if it appears in a directory name" ^ " in the prefix; if it does not appear anywhere" ^ " in the prefix or the suffix, it will be automatically" - ^ " placed at the beginning of the suffix.") + ^ " placed at the beginning of the suffix. " + ^ "\n\n" + ^ "One thing to be careful of: If the {\\tt backuploc} preference is set " + ^ "to {\\tt local}, Unison will automatically ignore {\\em all} files " + ^ "whose prefix and suffix match {\\tt backupprefix} and {\\tt backupsuffix}. " + ^ "So be careful to choose values for these preferences that are sufficiently " + ^ "different from the names of your real files.") let backupsuffix = Prefs.createString "backupsuffix" "" Modified: trunk/src/update.ml =================================================================== --- trunk/src/update.ml 2008-08-26 11:10:52 UTC (rev 308) +++ trunk/src/update.ml 2008-11-08 16:53:32 UTC (rev 309) @@ -1524,7 +1524,7 @@ and ignored paths *) (* FIX: The following line can be deleted -- it's just for debugging *) debug (fun() -> Util.msg "Running bogus external program\n"); -let _ = Os.runExternalProgram "dir" in +let _ = External.runExternalProgram "dir" in debug (fun() -> Util.msg "Finished running bogus external program\n"); findUpdatesOnPaths (Prefs.read Globals.paths) From bcpierce at seas.upenn.edu Sat Nov 8 11:54:30 2008 From: bcpierce at seas.upenn.edu (Benjamin C. Pierce) Date: Sat, 8 Nov 2008 11:54:30 -0500 Subject: [Unison-hackers] [unison-svn] r310 - trunk/src Message-ID: <200811081654.mA8GsUd7008997@yaws.seas.upenn.edu> Author: bcpierce Date: 2008-11-08 11:54:27 -0500 (Sat, 08 Nov 2008) New Revision: 310 Added: trunk/src/external.ml trunk/src/external.mli Modified: trunk/src/RECENTNEWS trunk/src/mkProjectInfo.ml Log: * (Forgot to add a couple of new files.) Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2008-11-08 16:53:32 UTC (rev 309) +++ trunk/src/RECENTNEWS 2008-11-08 16:54:27 UTC (rev 310) @@ -1,3 +1,10 @@ +CHANGES FROM VERSION 2.31.8 + +* (Forgot to add a couple of new files.) + + + +------------------------------- CHANGES FROM VERSION 2.31.5 * A special hack for Rasmus, who has a special situation that requires Added: trunk/src/external.ml =================================================================== --- trunk/src/external.ml (rev 0) +++ trunk/src/external.ml 2008-11-08 16:54:27 UTC (rev 310) @@ -0,0 +1,82 @@ +(* Unison file synchronizer: src/external.ml *) +(* Copyright 1999-2008 (see COPYING for details) *) + +(*****************************************************************************) +(* RUNNING EXTERNAL PROGRAMS *) +(*****************************************************************************) + +let debug = Util.debug "external" + +let (>>=) = Lwt.bind +open Lwt + +let readChannelTillEof c = + let rec loop lines = + try let l = input_line c in + (* Util.msg "%s\n" l; *) + loop (l::lines) + with End_of_file -> lines in + String.concat "\n" (Safelist.rev (loop [])) + +let readChannelTillEof_lwt c = + let rec loop lines = + let lo = + try + Some(Lwt_unix.run (Lwt_unix.input_line c)) + with End_of_file -> None + in + match lo with + Some l -> loop (l :: lines) + | None -> lines + in + String.concat "\n" (Safelist.rev (loop [])) + +let readChannelsTillEof l = + let rec suckitdry lines c = + Lwt.catch + (fun() -> Lwt_unix.input_line c >>= (fun l -> return (Some l))) + (fun e -> match e with End_of_file -> return None | _ -> raise e) + >>= (fun lo -> + match lo with + None -> return lines + | Some l -> suckitdry (l :: lines) c) in + Lwt_util.map + (fun c -> + suckitdry [] c + >>= (fun res -> return (String.concat "\n" (Safelist.rev res)))) + l + +let runExternalProgram cmd = + if Util.osType = `Win32 && not Util.isCygwin then begin + debug (fun()-> Util.msg "Executing external program windows-style\n"); + let c = Unix.open_process_in ("\"" ^ cmd ^ "\"") in + let log = readChannelTillEof c in + let returnValue = Unix.close_process_in c in + let mergeResultLog = + cmd ^ + (if log <> "" then "\n\n" ^ log else "") ^ + (if returnValue <> Unix.WEXITED 0 then + "\n\n" ^ Util.process_status_to_string returnValue + else + "") in + (returnValue,mergeResultLog) + end else Lwt_unix.run ( + Lwt_unix.open_process_full cmd (Unix.environment ()) + >>= (fun (out, ipt, err) -> + readChannelsTillEof [out;err] + >>= (function [logOut;logErr] -> + Lwt_unix.close_process_full (out, ipt, err) + >>= (fun returnValue -> + let logOut = Util.trimWhitespace logOut in + let logErr = Util.trimWhitespace logErr in + return (returnValue, ( + (* cmd + ^ "\n\n" ^ *) + (if logOut = "" || logErr = "" + then logOut ^ logErr + else logOut ^ "\n\n" ^ ("Error Output:" ^ logErr)) + ^ (if returnValue = Unix.WEXITED 0 + then "" + else "\n\n" ^ Util.process_status_to_string returnValue)))) + (* Stop typechechecker from complaining about non-exhaustive pattern above *) + | _ -> assert false))) Added: trunk/src/external.mli =================================================================== --- trunk/src/external.mli (rev 0) +++ trunk/src/external.mli 2008-11-08 16:54:27 UTC (rev 310) @@ -0,0 +1,5 @@ +(* Unison file synchronizer: src/external.mli *) +(* Copyright 1999-2008 (see COPYING for details) *) + +val runExternalProgram : string -> Unix.process_status * string +val readChannelTillEof : in_channel -> string Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2008-11-08 16:53:32 UTC (rev 309) +++ trunk/src/mkProjectInfo.ml 2008-11-08 16:54:27 UTC (rev 310) @@ -94,3 +94,4 @@ + From bcpierce at seas.upenn.edu Mon Nov 10 08:59:07 2008 From: bcpierce at seas.upenn.edu (Benjamin C. Pierce) Date: Mon, 10 Nov 2008 08:59:07 -0500 Subject: [Unison-hackers] [unison-svn] r311 - trunk/src Message-ID: <200811101359.mAADx76H004923@yaws.seas.upenn.edu> Author: bcpierce Date: 2008-11-10 08:59:05 -0500 (Mon, 10 Nov 2008) New Revision: 311 Modified: trunk/src/RECENTNEWS trunk/src/mkProjectInfo.ml trunk/src/props.ml Log: * Slight tweak to the last commit, suggested by Rasmus. Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2008-11-08 16:54:27 UTC (rev 310) +++ trunk/src/RECENTNEWS 2008-11-10 13:59:05 UTC (rev 311) @@ -1,3 +1,11 @@ +CHANGES FROM VERSION 2.31.9 + +* Slight tweak to the last commit, suggested by Rasmus. + + + + +------------------------------- CHANGES FROM VERSION 2.31.8 * (Forgot to add a couple of new files.) Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2008-11-08 16:54:27 UTC (rev 310) +++ trunk/src/mkProjectInfo.ml 2008-11-10 13:59:05 UTC (rev 311) @@ -95,3 +95,4 @@ + Modified: trunk/src/props.ml =================================================================== --- trunk/src/props.ml 2008-11-08 16:54:27 UTC (rev 310) +++ trunk/src/props.ml 2008-11-10 13:59:05 UTC (rev 311) @@ -507,7 +507,8 @@ time.Unix.tm_hour time.Unix.tm_min time.Unix.tm_sec in - let cmd = "touch -m -a -t " ^ tstr ^ " " ^ abspath in + let cmd = "/usr/local/bin/sudo -u root /usr/bin/touch -m -a -t " + ^ tstr ^ " '" ^ abspath ^ "'" in Util.msg "Running external program to set utimes:\n %s\n" cmd; let (r,_) = External.runExternalProgram cmd in if r<>(Unix.WEXITED 0) then raise (Util.Transient "External time-setting command failed") From bcpierce at seas.upenn.edu Tue Nov 11 08:13:30 2008 From: bcpierce at seas.upenn.edu (Benjamin C. Pierce) Date: Tue, 11 Nov 2008 08:13:30 -0500 Subject: [Unison-hackers] [unison-svn] r312 - trunk/src Message-ID: <200811111313.mABDDU5t023066@yaws.seas.upenn.edu> Author: bcpierce Date: 2008-11-11 08:13:29 -0500 (Tue, 11 Nov 2008) New Revision: 312 Modified: trunk/src/RECENTNEWS trunk/src/mkProjectInfo.ml trunk/src/props.ml Log: * Another slight tweak. Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2008-11-10 13:59:05 UTC (rev 311) +++ trunk/src/RECENTNEWS 2008-11-11 13:13:29 UTC (rev 312) @@ -1,3 +1,12 @@ +CHANGES FROM VERSION 2.31.10 + +* Another slight tweak. + + + + + +------------------------------- CHANGES FROM VERSION 2.31.9 * Slight tweak to the last commit, suggested by Rasmus. Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2008-11-10 13:59:05 UTC (rev 311) +++ trunk/src/mkProjectInfo.ml 2008-11-11 13:13:29 UTC (rev 312) @@ -96,3 +96,4 @@ + Modified: trunk/src/props.ml =================================================================== --- trunk/src/props.ml 2008-11-10 13:59:05 UTC (rev 311) +++ trunk/src/props.ml 2008-11-11 13:13:29 UTC (rev 312) @@ -500,7 +500,7 @@ spin off an external utility to do it). *) let time = Unix.localtime v in let tstr = Printf.sprintf - "%4d%02d%02d%2d%02d.%02d" + "%4d%02d%02d%02d%02d.%02d" (time.Unix.tm_year + 1900) (time.Unix.tm_mon + 1) time.Unix.tm_mday From hans_meine at gmx.net Sat Nov 22 19:47:41 2008 From: hans_meine at gmx.net (Hans Meine) Date: Sun, 23 Nov 2008 01:47:41 +0100 Subject: [Unison-hackers] Problem with fractional mtime? ("destination updated during synchronization") In-Reply-To: <200810292158.13947.hans_meine@gmx.net> References: <200810292158.13947.hans_meine@gmx.net> Message-ID: <200811230147.49766.hans_meine@gmx.net> On Mittwoch 29 Oktober 2008, Hans Meine wrote: > My impression after digging a little bit is that this is because on one of > the two systems, the mtime has several fractional digits, which seem to be > rounded up (incorrectly?) so that the non-fractional part is newer on the > other system. > [...] > Is this a known problem (and should I read some FM part which I missed)? > Oh, I am still using 2.13.16, I hope I did not just make a fool out of > myself by writing all this.. (disclaimer: I am currently sick.) In the meantime, I have confirmed that the same bug still exists in 2.27.57. The "rounding" in my last post does not make sense, probably it's more like this: - int remembered_mtime = trunc(remote_mtime) - ... [synchronize] - check whether remote_mtime > remembered_mtime: ALARM! [difference 0.0 < x < 1.0 seconds] -- Ciao, / / .o. /--/ ..o / / ANS ooo -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081122/69c21320/attachment.sig From hans_meine at gmx.net Sun Nov 23 07:42:36 2008 From: hans_meine at gmx.net (Hans Meine) Date: Sun, 23 Nov 2008 13:42:36 +0100 Subject: [Unison-hackers] Problem with fractional mtime? ("destination updated during synchronization") In-Reply-To: <200811230147.49766.hans_meine@gmx.net> References: <200810292158.13947.hans_meine@gmx.net> <200811230147.49766.hans_meine@gmx.net> Message-ID: <200811231342.44731.hans_meine@gmx.net> On Sonntag 23 November 2008, Hans Meine wrote: > In the meantime, I have confirmed that the same bug still exists in > 2.27.57. Now, I have to say that I tried to find a fix myself, but Ocaml is harder to read than I thought. I guess I have to wait for someone else to acknowledge this bug and fix it. > The "rounding" in my last post does not make sense, probably it's more like > this: > > - int remembered_mtime = trunc(remote_mtime) > - ... [synchronize] > - check whether remote_mtime > remembered_mtime: > ALARM! [difference 0.0 < x < 1.0 seconds] I have read that Ocaml does not do implicit casting (good!), and I did not find any casts (at least not in update.ml), so maybe I am still off with the above. It is also quite strange that it only with these sip-generated header files. Obviously, SIP somehow triggers the fractional mtime, while other programs do not seem to do that. Obscure. -- Ciao, / / .o. /--/ ..o / / ANS ooo -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part. Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081123/ca5685cc/attachment.sig From bcpierce at cis.upenn.edu Sun Nov 23 08:44:54 2008 From: bcpierce at cis.upenn.edu (Benjamin Pierce) Date: Sun, 23 Nov 2008 08:44:54 -0500 Subject: [Unison-hackers] Problem with fractional mtime? ("destination updated during synchronization") In-Reply-To: <200811231342.44731.hans_meine@gmx.net> References: <200810292158.13947.hans_meine@gmx.net> <200811230147.49766.hans_meine@gmx.net> <200811231342.44731.hans_meine@gmx.net> Message-ID: <39071660-FFFA-4852-A14D-3F57AE75D416@cis.upenn.edu> There is some rather tricky code in props.ml (in the sub-module Time) that compares file modtimes while trying to take into account some possible reasons why unchanged files may appear to have different modtimes (e.g., daylight savings time, or one filesystem being FAT, which can only store modtimes with a resolution of two seconds). If the problem you're seeing is really with fractional modtimes, it may be possible to fix it by changing something here... Best, - Benjamin On Nov 23, 2008, at 7:42 AM, Hans Meine wrote: > On Sonntag 23 November 2008, Hans Meine wrote: >> In the meantime, I have confirmed that the same bug still exists in >> 2.27.57. > > Now, I have to say that I tried to find a fix myself, but Ocaml is > harder to > read than I thought. I guess I have to wait for someone else to > acknowledge > this bug and fix it. > >> The "rounding" in my last post does not make sense, probably it's >> more like >> this: >> >> - int remembered_mtime = trunc(remote_mtime) >> - ... [synchronize] >> - check whether remote_mtime > remembered_mtime: >> ALARM! [difference 0.0 < x < 1.0 seconds] > > I have read that Ocaml does not do implicit casting (good!), and I > did not > find any casts (at least not in update.ml), so maybe I am still off > with the > above. > > It is also quite strange that it only with these sip-generated > header files. > Obviously, SIP somehow triggers the fractional mtime, while other > programs do > not seem to do that. Obscure. > > -- > Ciao, / / .o. > /--/ ..o > / / ANS ooo > _______________________________________________ > Unison-hackers mailing list > Unison-hackers at lists.seas.upenn.edu > http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers From alan.schmitt at polytechnique.org Wed Nov 26 10:37:53 2008 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Wed, 26 Nov 2008 16:37:53 +0100 Subject: [Unison-hackers] hash size in Unison archives? Message-ID: Hello, I'm going to be presenting Unison to a local group of Mac users in December, and I wanted to give a bit of technical information about how it works "under the hood". There is one piece of information that I'm missing right now, it's the size of the hash used in the archive to identify each file content (I want to argue that the probability of collision is very low). I could look at the code, but I'm sure one of you know by heart what it is ;-) Thanks, Alan -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081126/7ca011b4/PGP.sig From alan.schmitt at polytechnique.org Thu Nov 27 02:11:27 2008 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Thu, 27 Nov 2008 08:11:27 +0100 Subject: [Unison-hackers] history of Unison? Message-ID: <07D90B4E-BFFA-4E97-AE96-B9BC46B8EC64@polytechnique.org> Hello, Where can I find information about the history of Unison (except by asking here)? Specifically, I'd like to know when it started (under that name), and if the implementations were (in that order) in shell scripts, Pict, Java, and Caml. Thanks, Alan -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081127/f70f3265/PGP-0001.sig From alan.schmitt at polytechnique.org Thu Nov 27 09:35:31 2008 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Thu, 27 Nov 2008 15:35:31 +0100 Subject: [Unison-hackers] hash size in Unison archives? In-Reply-To: References: Message-ID: <8CD6764C-710C-4480-A91F-8BE2A4BC20EE@polytechnique.org> On 26 nov. 08, at 16:37, Alan Schmitt wrote: > Hello, > > I'm going to be presenting Unison to a local group of Mac users in > December, and I wanted to give a bit of technical information about > how it works "under the hood". There is one piece of information > that I'm missing right now, it's the size of the hash used in the > archive to identify each file content (I want to argue that the > probability of collision is very low). > > I could look at the code, but I'm sure one of you know by heart what > it is ;-) So I went to look at the code, and the answer is simply the same as the Digest module from the standard library: it's a 128 bits MD5 hash. Alan -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081127/bf2a6e46/PGP.sig From bcpierce at cis.upenn.edu Thu Nov 27 10:51:18 2008 From: bcpierce at cis.upenn.edu (Benjamin Pierce) Date: Thu, 27 Nov 2008 10:51:18 -0500 Subject: [Unison-hackers] history of Unison? In-Reply-To: <07D90B4E-BFFA-4E97-AE96-B9BC46B8EC64@polytechnique.org> References: <07D90B4E-BFFA-4E97-AE96-B9BC46B8EC64@polytechnique.org> Message-ID: <861FC600-E2FA-42DB-84BD-83598C368501@cis.upenn.edu> Hi Alan, Here's what I recall -- others can fill in any details I miss... 1994ish: BCP, having overwritten files the wrong direction between laptop and server for the n+1th time, pounds fist on desk and says, "It can't be that hard to write a file synchronizer..." First attempt written as a shell script that weekend. 1995ish: Cedric Fournet and BCP write a more serious synchronizer with a proper user interface, in Pict. (This was the largest program ever written in Pict. Was a lot of fun. :-) 1996-97: Sundar Balasubramaniam and BCP write a new tool called "snc", in Java, duplicating the functionality of the Pict version. It works, basically, but is hampered by a multitude of shortcomings in Java implementations available at the time. 1998-2001: Trevor Jim proposes building a new synchronizer implementation, using OCaml and focusing on cross-platform issues (Windows to Unix). Trevor and BCP are soon joined by Jerome Vouillon, who adds rocket power to the implementation effort. The current codebase grew directly out of this one. The name Unison started here. 2001-now: Big contributions by many more people, including Alan Schmitt, Malo Denielou, Zhe Yang, Sylvain Gommier, Norman Ramsey, Ben Willmore, Jacques Garrigue, and Matthieu Goulay. Best, - Benjamin On Nov 27, 2008, at 2:11 AM, Alan Schmitt wrote: > Hello, > > Where can I find information about the history of Unison (except by > asking here)? > > Specifically, I'd like to know when it started (under that name), > and if the implementations were (in that order) in shell scripts, > Pict, Java, and Caml. > > Thanks, > > Alan > _______________________________________________ > Unison-hackers mailing list > Unison-hackers at lists.seas.upenn.edu > http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers From chucksmith49 at comcast.net Sun Nov 30 04:06:11 2008 From: chucksmith49 at comcast.net (Chuck Smith) Date: Sun, 30 Nov 2008 02:06:11 -0700 Subject: [Unison-hackers] hash size in Unison archives? In-Reply-To: <8CD6764C-710C-4480-A91F-8BE2A4BC20EE@polytechnique.org> References: <8CD6764C-710C-4480-A91F-8BE2A4BC20EE@polytechnique.org> Message-ID: <001301c952ca$e47bf490$ad73ddb0$@net> Hi, You may use this bit of information in your Unison presentation to the Mac users: Unison has been cheerfully synchronizing web files between a certain large airline's HQ in Chicago and a certain airport in Denver for the past 19 months. As an aside, we have two servers synchronizing from the remote server without any performance glitches. All I had to do was run my script with Unison on each of my servers to achieve this redundancy. Unison rocks! Chuck -----Original Message----- From: unison-hackers-bounces at lists.seas.upenn.edu [mailto:unison-hackers-bounces at lists.seas.upenn.edu] On Behalf Of Alan Schmitt Sent: Thursday, November 27, 2008 7:36 AM To: Unison hackers Subject: Re: [Unison-hackers] hash size in Unison archives? On 26 nov. 08, at 16:37, Alan Schmitt wrote: > Hello, > > I'm going to be presenting Unison to a local group of Mac users in > December, and I wanted to give a bit of technical information about > how it works "under the hood". There is one piece of information that > I'm missing right now, it's the size of the hash used in the archive > to identify each file content (I want to argue that the probability of > collision is very low). > > I could look at the code, but I'm sure one of you know by heart what > it is ;-) So I went to look at the code, and the answer is simply the same as the Digest module from the standard library: it's a 128 bits MD5 hash. Alan From alan.schmitt at polytechnique.org Sun Nov 30 06:53:39 2008 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Sun, 30 Nov 2008 12:53:39 +0100 Subject: [Unison-hackers] hash size in Unison archives? In-Reply-To: <001301c952ca$e47bf490$ad73ddb0$@net> References: <8CD6764C-710C-4480-A91F-8BE2A4BC20EE@polytechnique.org> <001301c952ca$e47bf490$ad73ddb0$@net> Message-ID: <19ED79E8-311B-489B-A227-22F4CFC0BCC6@polytechnique.org> On 30 nov. 08, at 10:06, Chuck Smith wrote: > Hi, > > You may use this bit of information in your Unison presentation to > the Mac > users: > Unison has been cheerfully synchronizing web files between a certain > large > airline's HQ in Chicago and a certain airport in Denver for the past > 19 > months. > > As an aside, we have two servers synchronizing from the remote server > without any performance glitches. All I had to do was run my script > with > Unison on each of my servers to achieve this redundancy. > > Unison rocks! Thanks for the info. Alan -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part Url : http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20081130/36b282ff/PGP.sig From bcpierce at seas.upenn.edu Sun Nov 30 22:57:58 2008 From: bcpierce at seas.upenn.edu (Benjamin C. Pierce) Date: Sun, 30 Nov 2008 22:57:58 -0500 Subject: [Unison-hackers] [unison-svn] r313 - in trunk/src: . ubase Message-ID: <200812010357.mB13vwB8028603@yaws.seas.upenn.edu> Author: bcpierce Date: 2008-11-30 22:57:57 -0500 (Sun, 30 Nov 2008) New Revision: 313 Modified: trunk/src/RECENTNEWS trunk/src/TODO.txt trunk/src/fileinfo.ml trunk/src/mkProjectInfo.ml trunk/src/props.ml trunk/src/ubase/prefs.ml Log: * Fixed a bug that was causing new files to be created with permissions 0x600 instead of using a reasonable default (like 0x644), if the 'perms' flag was set to 0. (Bug reported by Ben Crowell.) * Added a new preference, 'dontchmod'. By default, Unison uses the 'chmod' system call to set the permission bits of files after it has copied them. But in some circumstances (and under some operating systems), the chmod call always fails. Setting this preference completely prevents Unison from ever calling chmod. * Add some suggestions to TODO file Modified: trunk/src/RECENTNEWS =================================================================== --- trunk/src/RECENTNEWS 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/RECENTNEWS 2008-12-01 03:57:57 UTC (rev 313) @@ -1,3 +1,24 @@ +CHANGES FROM VERSION 2.31.11 + +* Fixed a bug that was causing new files to be created with + permissions 0x600 instead of using a reasonable default (like + 0x644), if the 'perms' flag was set to 0. (Bug reported by Ben + Crowell.) + +* Added a new preference, 'dontchmod'. By default, Unison uses the + 'chmod' system call to set the permission bits of files after it has + copied them. But in some circumstances (and under some operating + systems), the chmod call always fails. Setting this preference + completely prevents Unison from ever calling chmod. + +* Add some suggestions to TODO file + + + + + + +------------------------------- CHANGES FROM VERSION 2.31.10 * Another slight tweak. Modified: trunk/src/TODO.txt =================================================================== --- trunk/src/TODO.txt 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/TODO.txt 2008-12-01 03:57:57 UTC (rev 313) @@ -8,8 +8,8 @@ ########################################################################### -CURRENT -======= +* CURRENT +* ======= * Merge issues: - It would be better to ignore the exit status of the external merge @@ -62,8 +62,8 @@ ########################################################################### -SOON -==== +* SOON +* ==== **** Document: root, fspath, path (local/not) @@ -182,8 +182,8 @@ ** Peter Selinger has built an SHA256 implementation that should be usable as a drop-in replacement for MD5, if we ever need to do that -BUILDING AND INSTALLING -======================= +* BUILDING AND INSTALLING +* ======================= ** 'make install' could be improved (and documented) 1. Typing "make install' after a "make" should simply install the @@ -200,8 +200,8 @@ should strip symbols from binary files in 'make exportnative' -DOCUMENTATION -============= +* DOCUMENTATION +* ============= ** Put a little more order on the flags and preferences -- e.g., organize them into "basic preferences", "advanced preferences," @@ -237,8 +237,8 @@ ===> Try it and see. -SMALL FUNCTIONALITY IMPROVEMENTS -================================ +* SMALL FUNCTIONALITY IMPROVEMENTS +* ================================ **** The archive should indicate whether it is case-dependant or not. (This is important for correctness -- if the case-insensitive flag is @@ -248,6 +248,12 @@ 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 + reset the permissions. Now unison tries to just do the changes, which + fails with a "permission denied" error. + *** [Adrian Stephens, 2007] I would like the scope of rootalias to be expanded so that any command that expects a root will perform aliasing on the command. In my application, I need to change the root statement @@ -693,8 +699,8 @@ Make sure you pay attention to the compile line as it is important. -USER INTERFACE -============== +* USER INTERFACE +* ============== ** In menu Actions - show Diff applies to the current line, while @@ -958,8 +964,8 @@ changes. -TIDYING -======= +* TIDYING +* ======= * Go through the sources and make all fatal and transient error messages as informative as possible @@ -975,8 +981,8 @@ Unison sources and see if it reveals any problems. -LARGER EXTENSIONS -================= +* LARGER EXTENSIONS +* ================= Fast update checking would be cool... Some resources: FAM (used in Enlightenment) @@ -1034,8 +1040,8 @@ paranoid.) -WINDOWS ISSUES -============== +* WINDOWS ISSUES +* ============== Suggestion from Arnaud: I have been using XP for a while and despite all the problems I have, there @@ -1077,3 +1083,7 @@ provided on FAT file systems) and the new way is the more Unix like way (added for NTFS file systems). The new way has rwxdpo bits for each group (and there can be several groups). + +Local Variables: +mode: outline +End: Modified: trunk/src/fileinfo.ml =================================================================== --- trunk/src/fileinfo.ml 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/fileinfo.ml 2008-12-01 03:57:57 UTC (rev 313) @@ -74,6 +74,12 @@ match action with `Set defDesc -> (* Set the permissions and maybe the other properties *) + (* BCP [Nov 2008]: Jerome, in a message to unison-hackers on + Oct 5, 2005, suggested that this would be better as + `Set, Props.override (get false fspath path).desc newDesc + but this does not seem right to me (bcp): if the file was just + created, then its permissions are something like 0x600, whereas + the default permissions will set the world read bit, etc. *) `Set, Props.override defDesc newDesc | `Copy oldPath -> (* Set the permissions (using the permissions of the file at *) Modified: trunk/src/mkProjectInfo.ml =================================================================== --- trunk/src/mkProjectInfo.ml 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/mkProjectInfo.ml 2008-12-01 03:57:57 UTC (rev 313) @@ -97,3 +97,4 @@ + Modified: trunk/src/props.ml =================================================================== --- trunk/src/props.ml 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/props.ml 2008-12-01 03:57:57 UTC (rev 313) @@ -73,6 +73,9 @@ let (fileDefault, dirDefault, fileSafe, dirSafe) = match Util.osType with `Win32 -> + debug + (fun() -> + Util.msg "Using windows defaults for file permissions"); ((0o600, -1), (* rw------- *) (0o700, -1), (* rwx------ *) (0o600, -1), (* rw------- *) @@ -162,8 +165,22 @@ bit 0o0002 "?" "-" "w" ^ bit 0o0001 "?" "-" "x" +let dontChmod = + Prefs.createBool "dontchmod" + false + "!When set, never use the chmod system call" + ("By default, Unison uses the 'chmod' system call to set the permission bits" + ^ " of files after it has copied them. But in some circumstances (and under " + ^ " some operating systems), the chmod call always fails. Setting this " + ^ " preference completely prevents Unison from ever calling chmod.") + let set fspath path kind (fp, mask) = - if mask <> 0 then (* BCP: removed "|| kind <> `Update" 10/2005 *) + (* BCP: removed "|| kind <> `Update" on 10/2005, but reinserted it on 11/2008. + I'd removed it to make Dale Worley happy -- he wanted a way to make sure that + Unison would never call chmod, and setting prefs to 0 seemed like a reasonable + way to do this. But in fact it caused new files to be created with wrong prefs. + *) + if (mask <> 0 || kind = `Set) && (not (Prefs.read dontChmod)) then Util.convertUnixErrorsToTransient "setting permissions" (fun () -> Modified: trunk/src/ubase/prefs.ml =================================================================== --- trunk/src/ubase/prefs.ml 2008-11-11 13:13:29 UTC (rev 312) +++ trunk/src/ubase/prefs.ml 2008-12-01 03:57:57 UTC (rev 313) @@ -391,4 +391,3 @@ let add name value = addLine (name ^ " = " ^ value) let addComment c = ignore (addLine ("# " ^ c)) -