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
commit6a96992fe0d1fd125684261c5a029e75e7820b4f
authorMartin Puppe <dev@mpuppe.de>
dateWed 26 Jan 2022, 16:23 (5 years ago)
parenta14bb13
nixos/modules/services/networking/kresd.nix+1−1
@@ -9,7 +9,7 @@ let
99 # On Nix level we don't attempt to precisely validate the address specifications.
1010 # The optional IPv6 scope spec comes *after* port, perhaps surprisingly.
1111 mkListen = kind: addr: let
12− al_v4 = builtins.match "([0-9.]+):([0-9]+)()" addr;
12+ al_v4 = builtins.match "([0-9.]+):([0-9]+)($)" addr;
1313 al_v6 = builtins.match "\\[(.+)]:([0-9]+)(%.*|$)" addr;
1414 al_portOnly = builtins.match "([0-9]+)" addr;
1515 al = findFirst (a: a != null)