diff -uNr unison-2.17.1.orig/stasher.ml unison-2.17.1/stasher.ml --- unison-2.17.1.orig/stasher.ml 2005-08-11 17:26:59.000000000 -0700 +++ unison-2.17.1/stasher.ml 2006-09-13 12:04:18.000000000 -0700 @@ -314,23 +314,36 @@ (Path.toString backPath) (Fspath.toString backRoot)); try Os.rename fspath path backRoot backPath - with - _ -> - ((let info = Fileinfo.get true fspath path in - match info.Fileinfo.typ with - `SYMLINK -> - Os.symlink - backRoot backPath - (Os.readLink fspath path) - | _ -> - Copy.localFile - fspath path - backRoot backPath backPath - `Copy - info.Fileinfo.desc - (Osx.ressLength info.Fileinfo.osX.Osx.ressInfo) - None); - Os.delete fspath path) + with + _ -> + debug (fun () -> Util.msg "Rename failed -- copying instead\n"); + let rec copy p backp = + let info = Fileinfo.get true fspath p in + match info.Fileinfo.typ with + | `SYMLINK -> + debug (fun () -> Util.msg " Copying link %s / %s to %s / %s\n" + (Fspath.toString fspath) (Path.toString p) + (Fspath.toString backRoot) (Path.toString backp)); + Os.symlink backRoot backp (Os.readLink fspath p) + | `FILE -> + debug (fun () -> Util.msg " Copying file %s / %s to %s / %s\n" + (Fspath.toString fspath) (Path.toString p) + (Fspath.toString backRoot) (Path.toString backp)); + Copy.localFile fspath p backRoot backp backp + `Copy info.Fileinfo.desc + (Osx.ressLength info.Fileinfo.osX.Osx.ressInfo) None + | `DIRECTORY -> + debug (fun () -> Util.msg " Copying directory %s / %s to %s / %s\n" + (Fspath.toString fspath) (Path.toString p) + (Fspath.toString backRoot) (Path.toString backp)); + Os.createDir backRoot backp info.Fileinfo.desc; + let ch = Os.childrenOf fspath p in + Safelist.iter (fun n -> copy (Path.child p n) (Path.child backp n)) ch + | `ABSENT -> assert false in + copy path backPath; + debug (fun () -> Util.msg " Finished copying; deleting %s / %s\n" + (Fspath.toString fspath) (Path.toString path)); + Os.delete fspath path end else begin debug ( fun () -> Util.msg "File %s in %s will not be backed up.\n" diff -uNr unison-2.17.1.orig/uutil.ml unison-2.17.1/uutil.ml --- unison-2.17.1.orig/uutil.ml 2005-08-11 17:26:59.000000000 -0700 +++ unison-2.17.1/uutil.ml 2006-09-13 12:01:33.000000000 -0700 @@ -123,4 +123,4 @@ end else if !l > 0 then notify !l in - Util.convertUnixErrorsToTransient "readWrite" (fun () -> read len) + Util.convertUnixErrorsToTransient "readWriteBounded" (fun () -> read len)