diff --git a/src/nix-find-roots/lib/find-roots.cc b/src/nix-find-roots/lib/find-roots.cc index 788f00465..84240b7b8 100644 --- a/src/nix-find-roots/lib/find-roots.cc +++ b/src/nix-find-roots/lib/find-roots.cc @@ -29,7 +29,7 @@ static std::string quoteRegexChars(const std::string & raw) } static std::regex storePathRegex(const fs::path storeDir) { - return std::regex(quoteRegexChars(storeDir) + R"(/[0-9a-z]+[0-9a-zA-Z\+\-\._\?=]*)"); + return std::regex(quoteRegexChars(storeDir) + R"((?!\.\.?(-|$))[0-9a-zA-Z\+\-\._\?=]+)"); } static bool isInStore(fs::path storeDir, fs::path dir)