From 8dca95386c9ab8b13886716ec31e1b2936a3ef10 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 5 Jun 2023 11:11:53 +0200 Subject: [PATCH] fetchClosure: Disallow toPath for inputAddressed = true --- src/libexpr/primops/fetchClosure.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libexpr/primops/fetchClosure.cc b/src/libexpr/primops/fetchClosure.cc index c66fed633..6d2271853 100644 --- a/src/libexpr/primops/fetchClosure.cc +++ b/src/libexpr/primops/fetchClosure.cc @@ -58,12 +58,11 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value * * arg bool inputAddressed = inputAddressedMaybe.value_or(false); if (inputAddressed) { - if (toPath && toPath != fromPath) + if (toPath) throw Error({ - .msg = hintfmt("attribute '%s' is set to true, but 'toPath' does not match 'fromPath'. 'toPath' should be equal, or should be omitted. Instead 'toPath' was '%s' and 'fromPath' was '%s'", + .msg = hintfmt("attribute '%s' is set to true, but '%s' is also set. Please remove one of them", "inputAddressed", - state.store->printStorePath(*toPath), - state.store->printStorePath(*fromPath)), + "toPath"), .errPos = state.positions[pos] }); assert(!enableRewriting);