From 6a96992fe0d1fd125684261c5a029e75e7820b4f Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Wed, 26 Jan 2022 16:23:14 +0100 Subject: [PATCH] Fix invalid regular expression #156861 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty parantheses are not supported in regular expressions on Darwin/macOS. The old regular expression produces an error during evaluation. This commit fixes that. Nix‘s `builtins.match` works with extend POSIX regular expressions. The specification for these regular expression states[^1] that the result for a left paranthesis immediately followed by a right paranthesis outside of a bracket expression is undefined. [^1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04_03 --- nixos/modules/services/networking/kresd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/kresd.nix b/nixos/modules/services/networking/kresd.nix index 16011573f8bb..28b8be7a9a0d 100644 --- a/nixos/modules/services/networking/kresd.nix +++ b/nixos/modules/services/networking/kresd.nix @@ -9,7 +9,7 @@ let # On Nix level we don't attempt to precisely validate the address specifications. # The optional IPv6 scope spec comes *after* port, perhaps surprisingly. mkListen = kind: addr: let - al_v4 = builtins.match "([0-9.]+):([0-9]+)()" addr; + al_v4 = builtins.match "([0-9.]+):([0-9]+)($)" addr; al_v6 = builtins.match "\\[(.+)]:([0-9]+)(%.*|$)" addr; al_portOnly = builtins.match "([0-9]+)" addr; al = findFirst (a: a != null)