Skip to content

fix: emit Windows batch launchers with CRLF line endings - #393

Merged
p0deje merged 1 commit into
bazel-contrib:mainfrom
titusfortner:windows-batch-line-endings
Aug 5, 2026
Merged

fix: emit Windows batch launchers with CRLF line endings#393
p0deje merged 1 commit into
bazel-contrib:mainfrom
titusfortner:windows-batch-line-endings

Conversation

@titusfortner

Copy link
Copy Markdown
Contributor

Problem

  • On Windows, rb_binary/rb_test intermittently failed with The system cannot find the batch label specified - rlocation, breaking runfiles lookups (rlocation, require 'bazel/runfiles'). Linux and macOS were unaffected.
  • Root cause is line endings, not batch logic: the generated .cmd launcher is LF-only, and cmd.exe seeks goto/call :label targets by byte offset — a scan that is unreliable on LF-only files. Failures were non-deterministic (whether a label straddled an internal read-buffer boundary), which is the signature of this bug rather than a code error.

Solution

  • Emit the generated .cmd with CRLF throughout. It's assembled from two pieces, so both are handled: the *.cmd.tpl templates are pinned to CRLF via .gitattributes, and the batch code injected from Starlark is normalized to CRLF.
  • The .gitattributes pin isn't dev-only. The same CRLF conversion is applied when the release archive is built, so consumers get the fixed launchers whether they depend on rules_ruby via BCR, an archive, or git.

Receipts

Downstream Selenium Windows CI, same target set, with an override onto this branch (SeleniumHQ/selenium@9e400e6):

@p0deje
p0deje merged commit ce26a14 into bazel-contrib:main Aug 5, 2026
56 checks passed
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.

2 participants