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.
wip/little-gl
sternenseemann 3 years ago
parent 326d0970e0
commit f39a5c4e50
  1. 2
      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

Loading…
Cancel
Save