From 3a64d3c0da2b169383256fd3198cf7d18f8ab163 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Sun, 28 Sep 2025 17:42:19 +0300 Subject: [PATCH] libstore: Call canonPath for constructing LocalFSStoreConfig::rootDir This mirrors what OptionalPathSetting does. Otherwise we run into an assertion failure for relative paths specified as the authority + path: nix build nixpkgs#hello --store "local://a/b" nix: ../posix-source-accessor.cc:13: nix::PosixSourceAccessor::PosixSourceAccessor(std::filesystem::__cxx11::path&&): Assertion `root.empty() || root.is_absolute()' failed. This is now diagnosed properly: error: not an absolute path: 'a/b' Just as you'd specify the root via a query parameter: nix build nixpkgs#hello --store "local?root=a/b" --- src/libstore/local-fs-store.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/local-fs-store.cc b/src/libstore/local-fs-store.cc index 66ae85d89..b16fc86e9 100644 --- a/src/libstore/local-fs-store.cc +++ b/src/libstore/local-fs-store.cc @@ -24,7 +24,7 @@ LocalFSStoreConfig::LocalFSStoreConfig(PathView rootDir, const Params & params) // FIXME don't duplicate description once we don't have root setting , rootDir{ this, - !rootDir.empty() && params.count("root") == 0 ? (std::optional{rootDir}) : std::nullopt, + !rootDir.empty() && params.count("root") == 0 ? (std::optional{canonPath(rootDir)}) : std::nullopt, "root", "Directory prefixed to all other paths."} {