Fix extra slash in canonPath output
When you have a symlink like:
/tmp -> ./private/tmp
you need to resolve ./private/tmp relative to /tmp’s dir: ‘/’. Unlike
any other path output by dirOf, / ends with a slash. We don’t want
trailing slashes here since we will append another slash in the next
comoponent, so clear s like we would if it was a symlink to an absoute
path.
This should fix at least part of the issue in
https://github.com/NixOS/nix/issues/4822, will need confirmation that
it actually fixes the problem to close though.
Introduced in f3f228700a
.
This commit is contained in:
parent
bd6cf25952
commit
3d90ab9345
|
@ -155,6 +155,9 @@ Path canonPath(const Path & path, bool resolveSymlinks)
|
||||||
s.clear(); /* restart for symlinks pointing to absolute path */
|
s.clear(); /* restart for symlinks pointing to absolute path */
|
||||||
} else {
|
} else {
|
||||||
s = dirOf(s);
|
s = dirOf(s);
|
||||||
|
if (s == "/") { // we don’t want trailing slashes here, which dirOf only produces if s = /
|
||||||
|
s.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue