Skip to content

Keep shell installer line endings portable#24

Merged
Turtle-Hwan merged 1 commit into
mainfrom
feat/fix-installer-line-endings
May 28, 2026
Merged

Keep shell installer line endings portable#24
Turtle-Hwan merged 1 commit into
mainfrom
feat/fix-installer-line-endings

Conversation

@Turtle-Hwan
Copy link
Copy Markdown
Contributor

Summary

  • Force shell scripts to check out with LF line endings.
  • Add a regression test so install.sh cannot drift back to CRLF and break Bash parsing on macOS/Linux or Windows Bash environments.

Validation

  • bash -n scripts/install.sh
  • npm test
  • git diff --check

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures gitattributes to enforce LF line endings for shell scripts and adds a test to verify that the installer script does not contain CRLF line endings. The reviewer suggests strengthening the test assertion to check for any carriage return character (\r) instead of just \r\n to ensure complete portability.

it('keeps shell installers LF-only so bash can parse them on every OS', () => {
const installer = readFileSync(join(root, 'scripts', 'install.sh'), 'utf8')

assert.doesNotMatch(installer, /\r\n/)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure complete portability and prevent any carriage return characters from causing syntax errors in Bash, it is safer to assert the absence of any carriage return (\r) rather than specifically the CRLF sequence (\r\n). A lone \r can also cause issues in Unix environments.

Suggested change
assert.doesNotMatch(installer, /\r\n/)
assert.doesNotMatch(installer, /\r/)

@Turtle-Hwan Turtle-Hwan merged commit ad274a6 into main May 28, 2026
@Turtle-Hwan Turtle-Hwan deleted the feat/fix-installer-line-endings branch May 28, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant