diff options
| author | Mikael Voss <mvs@nyantec.com> | 2025-03-13 12:57:06 +0100 |
|---|---|---|
| committer | Mikael Voss <mvs@nyantec.com> | 2025-04-02 13:26:43 +0200 |
| commit | bf790d1a7fffcfd5c6a92711179d644119128a61 (patch) | |
| tree | 18969afd6d67392a3dd18a0bc57bd9a97cb55dc7 | |
| parent | polkadot: 2412-3 -> 2412-4 (#395145) (diff) | |
| download | nixpkgs-bf790d1a7fffcfd5c6a92711179d644119128a61.tar.gz | |
lib/path: properly handle /. in hasStorePathPrefix
| -rw-r--r-- | lib/path/default.nix | 2 | ||||
| -rw-r--r-- | lib/path/tests/unit.nix | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/path/default.nix b/lib/path/default.nix index be559eadf182..1284bed94bb0 100644 --- a/lib/path/default.nix +++ b/lib/path/default.nix @@ -165,7 +165,7 @@ let # This is a workaround for https://github.com/NixOS/nix/issues/12361 which # was needed during the experimental phase of ca-derivations and should be # removed once the issue has been resolved. - || match "[0-9a-z]{52}" (head components) != null; + || components != [ ] && match "[0-9a-z]{52}" (head components) != null; in # No rec! Add dependencies on this file at the top. diff --git a/lib/path/tests/unit.nix b/lib/path/tests/unit.nix index a52b4f44e51d..fa2e004e9c3a 100644 --- a/lib/path/tests/unit.nix +++ b/lib/path/tests/unit.nix @@ -110,6 +110,12 @@ let expected = false; }; + # Root path (empty path components list) + testHasStorePathPrefixRoot = { + expr = hasStorePathPrefix /.; + expected = false; + }; + testHasStorePathPrefixExample1 = { expr = hasStorePathPrefix (storeDirPath + "/nvl9ic0pj1fpyln3zaqrf4cclbqdfn1j-foo/bar/baz"); expected = true; |
