Enforce LF line endings for Unix artifacts via .gitattributes
Template tests / tests (pull_request) Failing after 32s
Template tests / tests (pull_request) Failing after 32s
A shell script, .desktop, .rules, or .spec file checked out with CRLF (Windows with core.autocrlf=true) breaks when run/parsed on Linux — a `#!/usr/bin/env bash\r` shebang is a "bad interpreter" error, and the Linux package would ship broken scripts. Pin these (and other text) to LF, and mark binary assets (png/gz/traineddata) so they are never converted. Also harden the packaging/wayland structural tests to strip CR defensively. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Normalize line endings. Unix artifacts MUST stay LF: a shell script or
|
||||
# desktop/udev/spec file checked out with CRLF (e.g. on Windows with
|
||||
# core.autocrlf=true) fails to run on Linux — `#!/usr/bin/env bash\r` is a
|
||||
# "bad interpreter" error, and .desktop/.rules parsers choke on trailing \r.
|
||||
* text=auto eol=lf
|
||||
|
||||
*.sh text eol=lf
|
||||
*.desktop text eol=lf
|
||||
*.rules text eol=lf
|
||||
*.spec text eol=lf
|
||||
*.xml text eol=lf
|
||||
control.in text eol=lf
|
||||
*.js text eol=lf
|
||||
*.mjs text eol=lf
|
||||
*.cjs text eol=lf
|
||||
*.json text eol=lf
|
||||
*.md text eol=lf
|
||||
launcher.sh text eol=lf
|
||||
|
||||
# Binary assets must never be line-ending converted.
|
||||
*.png binary
|
||||
*.ico binary
|
||||
*.gz binary
|
||||
*.traineddata binary
|
||||
@@ -6,7 +6,8 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..', '..');
|
||||
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
|
||||
// Strip CR so /^...$/m assertions are robust to CRLF checkouts on Windows CI.
|
||||
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n');
|
||||
const exists = (rel) => fs.existsSync(path.join(ROOT, rel));
|
||||
|
||||
// These are structural checks that run in the normal (cross-platform) unit
|
||||
|
||||
@@ -9,7 +9,8 @@ const { chooseCaptureTrigger, detectLinuxCapabilities } = require('../../app/pla
|
||||
const platform = require('../../app/platform');
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..', '..');
|
||||
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8');
|
||||
// Strip CR so assertions are robust to CRLF checkouts on Windows CI.
|
||||
const read = (rel) => fs.readFileSync(path.join(ROOT, rel), 'utf8').replace(/\r\n/g, '\n');
|
||||
const exists = (rel) => fs.existsSync(path.join(ROOT, rel));
|
||||
|
||||
// ---- honest trigger decisions ----------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user