diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 5f597bf06..7e57fd7ca 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -155,6 +155,9 @@ Path canonPath(const Path & path, bool resolveSymlinks) s.clear(); /* restart for symlinks pointing to absolute path */ } else { s = dirOf(s); + if (s == "/") { // we don’t want trailing slashes here, which dirOf only produces if s = / + s.clear(); + } } } }