summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Puppe <dev@mpuppe.de>2022-01-26 16:23:14 +0100
committerMartin Puppe <dev@mpuppe.de>2022-01-26 16:23:14 +0100
commit6a96992fe0d1fd125684261c5a029e75e7820b4f (patch)
treef2307dc185dacac9b21fa60216d76f3228c71367
parenta14bb132b5feb587cad828ed8a0d13115598ef32 (diff)
downloadnixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar.gz
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar.bz2
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar.lz
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar.xz
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.tar.zst
nixpkgs-6a96992fe0d1fd125684261c5a029e75e7820b4f.zip
Fix invalid regular expression #156861
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
-rw-r--r--nixos/modules/services/networking/kresd.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/kresd.nix b/nixos/modules/services/networking/kresd.nix
index 16011573f8b..28b8be7a9a0 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)