From 6041531716c29dc7ad219299e2b28782ba75bb4f Mon Sep 17 00:00:00 2001 From: Samuli Thomasson Date: Mon, 2 Jun 2025 01:53:59 +0200 Subject: [PATCH] throw BadStorePath for empty string some of the functional tests that run config check wouldn't tolerate some oddities in `PATH`, something like a null string entry (e.g. `::` in the middle or a trailing `:`) I think. This allows the test pass. Signed-off-by: Samuli Thomasson --- src/libstore/path.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libstore/path.cc b/src/libstore/path.cc index d989b1caa..595cf77e1 100644 --- a/src/libstore/path.cc +++ b/src/libstore/path.cc @@ -77,6 +77,9 @@ StorePath StorePath::random(std::string_view name) StorePath MixStoreDirMethods::parseStorePath(std::string_view path) const { + if (path.empty()) + throw BadStorePath("empty path is not a valid store path"); + // On Windows, `/nix/store` is not a canonical path. More broadly it // is unclear whether this function should be using the native // notion of a canonical path at all. For example, it makes to