Loading
nixos/lib/systemd-lib: make unitNameType work with e.g. Rust regex
The unitNameType regex currently makes the Tvix CI (and likely Snix in the future) fail since "sysroot-nix-.ro\\x2dstore.mount" will fail the check since it doesn't interpret the single backslash as part of the bracket expression. POSIX doesn't require escaping the backslash in bracket exprs: > The special characters '.', '*', '[', and '\\' ( <period>, <asterisk>, > <left-square-bracket>, and <backslash>, respectively) shall lose their > special meaning within a bracket expression. However, Rust uses the backslash for escaping in bracket exprs, so it also needs to be escaped: > [\[\]] Escaping in character classes (matching [ or ]) Making the Regex work with both POSIX-like regexes and Rust's regex syntax is possible in this case, so let's do it.