From f39a5c4e50c3f0dfb108b399c2da2c963d4d1a98 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Tue, 4 May 2021 15:07:56 +0200 Subject: [PATCH] lib/strings: forbid lists in isStorePath When a list is passed to isStorePath this is most likely a mistake and it is therefore better to just return false. There is one case where this theoretically makes sense (if a list contains a single element for which isStorePath elem), but since that case is also probably seldomly intentional, it may save someone from debbuging unclear evaluation errors. --- lib/strings.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/strings.nix b/lib/strings.nix index dc287f8dd5c..49fa0196a0b 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -667,7 +667,7 @@ rec { => false */ isStorePath = x: - if isCoercibleToString x then + if !(isList x) && isCoercibleToString x then let str = toString x; in substring 0 1 str == "/" && dirOf str == storeDir