[Unison-hackers] relative path error in 2.17.1
Joseph Collins
jcc3 at comcast.net
Thu Oct 13 12:10:34 EDT 2005
Since string index begins at 0, perhaps the offset argument of String.sub in fullLocalPath should be r and not r+1,
as follows, if the intent is to strip roots from fspaths. I am not sure what impact this has on all filesystems.
unison-2.17.1$ diff -U 9 fspath-0.ml fspath.ml
--- fspath-0.ml 2005-08-11 20:26:59.000000000 -0400
+++ fspath.ml 2005-10-13 11:11:24.791390500 -0400
@@ -209,19 +209,19 @@
let rec fullLocalPath roots fspath path =
let r = String.length roots in
let fspaths = toString fspath in
if fspaths = roots then
path
else
let parent = Path.parent path in
if Path.isEmpty parent then
let name = Name.fromString (Path.toString path) in
- Path.child (Path.fromString (String.sub fspaths (r+1) (String.length fspaths - r - 1))) name
+ Path.child (Path.fromString (String.sub fspaths r (String.length fspaths - r - 1))) name
else
let localParentPath = fullLocalPath roots fspath parent in
match Path.finalName (Path.magic' path) with
Some n -> Path.child localParentPath n
| None -> localParentPath
(* Return the canonical fspath of a filename (string), relative to the *)
(* current host, current directory. *)
unison-2.17.1$
More information about the Unison-hackers
mailing list