From 8c39e8db4eb4037fd5ba13ff875e4229855a9655 Mon Sep 17 00:00:00 2001 From: Twest2 Date: Fri, 3 Jul 2026 23:42:45 -0500 Subject: [PATCH] Make the enable-script guard robust to CRLF line endings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wayland-honesty guard stripped comments per line to check usermod is never run, but the comment-strip regex depended on `.`/`$` behavior that breaks on Windows CRLF checkouts (`.` does not cross `\r`), so the comment's cautionary usermod mention was read as a command and the test failed only on windows- latest CI. Check command position (line start, optional sudo) in multiline mode instead — line-ending agnostic. Co-Authored-By: Claude Fable 5 --- tests/unit/wayland-honesty.test.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/unit/wayland-honesty.test.js b/tests/unit/wayland-honesty.test.js index 442faf6..f01518a 100644 --- a/tests/unit/wayland-honesty.test.js +++ b/tests/unit/wayland-honesty.test.js @@ -71,11 +71,10 @@ test('the enable script is opt-in and installs the least-privilege rule, not the const script = read('scripts/linux/enable-click-capture.sh'); assert.match(script, /read -r reply/, 'must confirm before installing'); assert.match(script, /60-stepforge-input\.rules/, 'installs the least-privilege udev rule'); - // usermod may only appear in a comment (warning), never as an executed command. - for (const line of script.split('\n')) { - const code = line.replace(/#.*$/, ''); - assert.doesNotMatch(code, /usermod -aG input/, 'must not run the broad input-group command'); - } + // usermod may only appear in a comment (warning), never as an executed + // command. Check command position (line start, optional sudo) so this is + // robust to CRLF vs LF line endings across platforms. + assert.doesNotMatch(script, /^\s*(sudo\s+)?usermod\b/m, 'must not run the broad input-group command'); }); // ---- docs no longer push the broad input group ------------------------------