From 1d22874ab29f696c38146750bdd26645d4d75ccc Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 27 Nov 2020 16:24:08 -0500 Subject: fix(tvix): Don't call assertStorePath on BasicDerivation.builder Upstream doesn't, and for good reason - this might not be a store path, for example if it's /bin/sh Fixes: b/73 Change-Id: If9aa96de2cd8ab941c098a9f122b8b302a92ec38 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2175 Reviewed-by: kanepyork Tested-by: BuildkiteCI --- third_party/nix/src/libstore/derivations.cc | 3 +-- third_party/nix/src/libstore/derivations.hh | 5 ++--- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/third_party/nix/src/libstore/derivations.cc b/third_party/nix/src/libstore/derivations.cc index ed184b6d9de4..9c344502f386 100644 --- a/third_party/nix/src/libstore/derivations.cc +++ b/third_party/nix/src/libstore/derivations.cc @@ -43,11 +43,10 @@ nix::proto::Derivation_DerivationOutput DerivationOutput::to_proto() const { } BasicDerivation BasicDerivation::from_proto( - const nix::proto::Derivation* proto_derivation, const nix::Store& store) { + const nix::proto::Derivation* proto_derivation) { BasicDerivation result; result.platform = proto_derivation->platform(); result.builder = proto_derivation->builder().path(); - store.assertStorePath(result.builder); for (auto [k, v] : proto_derivation->outputs()) { result.outputs.emplace(k, v); diff --git a/third_party/nix/src/libstore/derivations.hh b/third_party/nix/src/libstore/derivations.hh index 8d46b58b5c0d..4966b858d3b3 100644 --- a/third_party/nix/src/libstore/derivations.hh +++ b/third_party/nix/src/libstore/derivations.hh @@ -58,10 +58,9 @@ struct BasicDerivation { BasicDerivation() = default; - // Convert the given proto derivation to a BasicDerivation in the given - // nix::Store. + // Convert the given proto derivation to a BasicDerivation static BasicDerivation from_proto( - const nix::proto::Derivation* proto_derivation, const nix::Store& store); + const nix::proto::Derivation* proto_derivation); [[nodiscard]] nix::proto::Derivation to_proto() const; diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc index eab10e9572aa..597ef2434a07 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc @@ -674,15 +674,13 @@ class WorkerServiceImpl final : public WorkerService::Service { } Status BuildDerivation( - grpc::ServerContext* context, - const nix::proto::BuildDerivationRequest* request, + grpc::ServerContext*, const nix::proto::BuildDerivationRequest* request, grpc::ServerWriter* writer) override { return HandleExceptions( [&]() -> Status { auto drv_path = request->drv_path().path(); ASSERT_INPUT_STORE_PATH(drv_path); - auto drv = - BasicDerivation::from_proto(&request->derivation(), *store_); + auto drv = BasicDerivation::from_proto(&request->derivation()); auto build_mode = nix::BuildModeFrom(request->build_mode()); if (!build_mode) { -- cgit 1.4.1