1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-29 05:31:00 +01:00

Fix handling of relative paths

In particular, 'path:..' got turned into 'path:.' because isRelative()
returned a CanonPath, which cannot represent '..'.

Reported by @erikarvstedt.
This commit is contained in:
Eelco Dolstra 2022-10-10 18:56:19 +02:00
parent 7317196807
commit 511590976c
5 changed files with 7 additions and 6 deletions

View file

@ -61,6 +61,7 @@ CanonPath CanonPath::operator + (const CanonPath & x) const
void CanonPath::push(std::string_view c)
{
assert(c.find('/') == c.npos);
assert(c != "." && c != "..");
if (!isRoot()) path += '/';
path += c;
}