diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 50d03f369..6203a11a6 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -35,7 +35,7 @@ std::pair decodeContext(const string & s) size_t index = s.find("!", 1); return std::pair(string(s, index + 1), string(s, 1, index - 1)); } else - return std::pair(s, ""); + return std::pair(s.at(0) == '/' ? s: string(s, 1), ""); } @@ -51,7 +51,7 @@ void realiseContext(const PathSet & context) assert(isStorePath(ctx)); if (!store->isValidPath(ctx)) throw InvalidPathError(ctx); - if (isDerivation(ctx)) + if (!decoded.second.empty() && isDerivation(ctx)) drvs.insert(decoded.first + "!" + decoded.second); } if (!drvs.empty()) {