From fecb444e18c2d655d7de4253047e664873b42cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 12 Aug 2018 10:17:08 +0200 Subject: [PATCH] lib/strings: guard against an easy mistake This would catch the bad `fwknop` flags fixed in 580cab57e4, during evaluation already. --- lib/strings.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/strings.nix b/lib/strings.nix index 7cd09a10939..1dba455628d 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -412,7 +412,9 @@ rec { enableFeature false "shared" => "--disable-shared" */ - enableFeature = enable: feat: "--${if enable then "enable" else "disable"}-${feat}"; + enableFeature = enable: feat: + assert isString feat; # e.g. passing openssl instead of "openssl" + "--${if enable then "enable" else "disable"}-${feat}"; /* Create an --{enable-=,disable-} string that can be passed to standard GNU Autoconf scripts. @@ -434,7 +436,9 @@ rec { withFeature false "shared" => "--without-shared" */ - withFeature = with_: feat: "--${if with_ then "with" else "without"}-${feat}"; + withFeature = with_: feat: + assert isString feat; # e.g. passing openssl instead of "openssl" + "--${if with_ then "with" else "without"}-${feat}"; /* Create an --{with-=,without-} string that can be passed to standard GNU Autoconf scripts.