Make the enable-script guard robust to CRLF line endings
Template tests / tests (pull_request) Failing after 3m22s
Template tests / tests (pull_request) Failing after 3m22s
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 <[email protected]>
This commit is contained in:
@@ -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 ------------------------------
|
||||
|
||||
Reference in New Issue
Block a user