From ea54be0d967d2935c2e0504d760d4df1f1cf80f8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 30 Apr 2024 19:38:34 +0200 Subject: [PATCH] filterPath: Ensure /nix/store/--source Issue #10627. --- src/libexpr/primops.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index d52ca479d70..4cf32d143c0 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -2376,7 +2376,18 @@ static void prim_filterSource(EvalState & state, const PosIdx pos, Value * * arg "while evaluating the second argument (the path to filter) passed to 'builtins.filterSource'"); state.forceFunction(*args[0], pos, "while evaluating the first argument passed to builtins.filterSource"); - addPath(state, pos, path.baseName(), path, args[0], FileIngestionMethod::Recursive, std::nullopt, v, context); + addPath( + state, + pos, + path.path.isRoot() + ? state.store->computeStorePath("source", *path.accessor, path.path).first.to_string() + : path.baseName(), + path, + args[0], + FileIngestionMethod::Recursive, + std::nullopt, + v, + context); } static RegisterPrimOp primop_filterSource({