Skip to content

Pin .w sources and the ABI-hash record to LF (fix Windows abi-hash-check red) - #942

Merged
ehartford merged 1 commit into
mainfrom
fix-abi-hash-crlf-windows
Sep 3, 2026
Merged

ehartford merged 1 commit into
mainfrom
fix-abi-hash-crlf-windows

Conversation

@ropoctl

@ropoctl ropoctl commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Problem

main is red on both Windows lanes (x86_64 and aarch64) at the green battery:

error: action target 'abi-hash-check' failed during comptime evaluation:
       ToolFs path escapes project root in sha256_file: src/FnAbi.w

Root cause

GitHub's Windows runners check out with core.autocrlf=true, so any text file without an
eol attribute is rewritten LF→CRLF on checkout.

run_abi_hash_check_action (build/abi.w) reads docs/with-abi.sha256, splits it on \n
only, and hashes the path in each record line's second column. On a Windows (CRLF) checkout
every line keeps a trailing \r, so the path parses as src/FnAbi.w\r. The comptime ToolFs
project-root guard (ComptimeEval.w comptime_tool_path_is_project_relative) rejects any
path containing a control byte (byte 13 = CR), which is the failure above — the \r is
invisible in the log, so it reads as src/FnAbi.w.

Fixing only the path would then trade the error for a hash mismatch: the check hashes the
raw bytes of src/FnAbi.w and src/TypeLayout.w, whose recorded sha256s were taken from the
LF sources, while a CRLF checkout hashes different bytes. That hash keys every .wo bundle
(D38, docs/with-abi.md §7) and must be identical on every platform, so the sources feeding
it have to be byte-stable across platforms.

Fix

Pin all .w source and docs/with-abi.sha256 to text eol=lf in .gitattributes, so a
Windows checkout keeps LF — same mechanism as the existing #801 pin for test/behavior/*.txt.

  • No blob content changes: every tracked file is already LF in the index (git add --renormalize . stages only .gitattributes); this only enforces LF on future checkouts
    and commits.
  • Linux/macOS are already LF, so they are unaffected (the linux lane on this commit is green).
  • Verification is the Windows CI on this PR: the abi-hash-check now hashes LF bytes matching
    the recorded sha256s.

GitHub's Windows runners check out with core.autocrlf=true, so any text
file without an eol attribute is rewritten LF->CRLF on checkout. The new
abi-hash-check target reads docs/with-abi.sha256, splits it on '\n', and
hashes each path it lists. On a Windows checkout the CRLF endings left a
trailing '\r' on every record line, so the path column parsed as
"src/FnAbi.w\r"; the comptime ToolFs project-root guard rejects any path
containing a control byte and failed the target with
"ToolFs path escapes project root in sha256_file: src/FnAbi.w".

Fixing only the path would then surface a hash mismatch: the check hashes
the raw bytes of src/FnAbi.w and src/TypeLayout.w, whose recorded sha256s
were taken from the LF sources, while a CRLF checkout hashes different
bytes. That hash keys every .wo bundle and must be identical on every
platform, so the sources feeding it must be byte-stable across platforms.

Pin all .w source and docs/with-abi.sha256 to `text eol=lf` so a Windows
checkout keeps LF. No blob content changes — every tracked file is already
LF in the index; this only enforces LF on future checkouts and commits.
@ropoctl
ropoctl requested a review from ehartford September 3, 2026 04:56
@ehartford
ehartford merged commit 6587d1f into main Sep 3, 2026
5 checks passed
ropoctl added a commit that referenced this pull request Sep 4, 2026
test/bundle_interface/*.wi fixtures are compared byte-for-byte against the
compiler's freshly-emitted interface. Under core.autocrlf=true (GitHub's
Windows runners' default) a native Windows checkout rewrites the checked-in
fixture's LF to CRLF, so every read line carries a trailing "\r" the emitted
(LF) interface never has -- the byte-exact comparison then fails on every line
and reds bundle-interface-tests on Windows only, while it passes on Linux/mac.

Root cause: the .wi fixtures were never covered by an eol=lf attribute, unlike
*.w and docs/with-abi.sha256 (#942). Pin *.wi text eol=lf so the checked-out
fixture bytes match emitted output on every platform. No CRLF exists in any .wi
blob today, so the pin is a no-op on Linux/mac and only corrects the Windows
checkout.
ropoctl added a commit that referenced this pull request Sep 4, 2026
test/bundle_interface/*.wi fixtures are compared byte-for-byte against the
compiler's freshly-emitted interface. Under core.autocrlf=true (GitHub's
Windows runners' default) a native Windows checkout rewrites the checked-in
fixture's LF to CRLF, so every read line carries a trailing "\r" the emitted
(LF) interface never has -- the byte-exact comparison then fails on every line
and reds bundle-interface-tests on Windows only, while it passes on Linux/mac.

Root cause: the .wi fixtures were never covered by an eol=lf attribute, unlike
*.w and docs/with-abi.sha256 (#942). Pin *.wi text eol=lf so the checked-out
fixture bytes match emitted output on every platform. No CRLF exists in any .wi
blob today, so the pin is a no-op on Linux/mac and only corrects the Windows
checkout.
ropoctl added a commit that referenced this pull request Sep 4, 2026
test/bundle_interface/*.wi fixtures are compared byte-for-byte against the
compiler's freshly-emitted interface. Under core.autocrlf=true (GitHub's
Windows runners' default) a native Windows checkout rewrites the checked-in
fixture's LF to CRLF, so every read line carries a trailing "\r" the emitted
(LF) interface never has -- the byte-exact comparison then fails on every line
and reds bundle-interface-tests on Windows only, while it passes on Linux/mac.

Root cause: the .wi fixtures were never covered by an eol=lf attribute, unlike
*.w and docs/with-abi.sha256 (#942). Pin *.wi text eol=lf so the checked-out
fixture bytes match emitted output on every platform. No CRLF exists in any .wi
blob today, so the pin is a no-op on Linux/mac and only corrects the Windows
checkout.
ropoctl added a commit that referenced this pull request Sep 4, 2026
test/bundle_interface/*.wi fixtures are compared byte-for-byte against the
compiler's freshly-emitted interface. Under core.autocrlf=true (GitHub's
Windows runners' default) a native Windows checkout rewrites the checked-in
fixture's LF to CRLF, so every read line carries a trailing "\r" the emitted
(LF) interface never has -- the byte-exact comparison then fails on every line
and reds bundle-interface-tests on Windows only, while it passes on Linux/mac.

Root cause: the .wi fixtures were never covered by an eol=lf attribute, unlike
*.w and docs/with-abi.sha256 (#942). Pin *.wi text eol=lf so the checked-out
fixture bytes match emitted output on every platform. No CRLF exists in any .wi
blob today, so the pin is a no-op on Linux/mac and only corrects the Windows
checkout.
ehartford pushed a commit that referenced this pull request Sep 5, 2026
test/bundle_interface/*.wi fixtures are compared byte-for-byte against the
compiler's freshly-emitted interface. Under core.autocrlf=true (GitHub's
Windows runners' default) a native Windows checkout rewrites the checked-in
fixture's LF to CRLF, so every read line carries a trailing "\r" the emitted
(LF) interface never has -- the byte-exact comparison then fails on every line
and reds bundle-interface-tests on Windows only, while it passes on Linux/mac.

Root cause: the .wi fixtures were never covered by an eol=lf attribute, unlike
*.w and docs/with-abi.sha256 (#942). Pin *.wi text eol=lf so the checked-out
fixture bytes match emitted output on every platform. No CRLF exists in any .wi
blob today, so the pin is a no-op on Linux/mac and only corrects the Windows
checkout.

(cherry picked from commit 4aad416)
@ehartford
ehartford deleted the fix-abi-hash-crlf-windows branch September 24, 2026 16:56
ehartford pushed a commit that referenced this pull request Oct 2, 2026
…ew-tests red) (#1887)

contract-view-tests compares each test/contract/*.w's contract view with its
.expected file byte for byte, and uat-tests compares the UAT runner's report
and listing with test/uat/expected*.txt the same way. Under core.autocrlf=true
(Git for Windows' default, and GitHub's Windows runners') a native checkout
rewrites those files to CRLF, while the outputs are LF, so every line differs.
On main 9ee1234, windows-x86_64: contract-view-tests fails on all six
.expected files, and uat-tests fails on both comparisons, CR on every line.

Pin them to LF, as #801 and #942 did for the embed_file fixtures and the .w
sources. With this change contract-view-tests is green. uat-tests is still red
on Windows for two reasons of its own (the verbs scenario's
`run: ./out/bin/tmp` exits -2, and skip_platform prints `windows` where the
listing expects `<host>`), but its report and listing no longer differ on
line endings.

Co-authored-by: Josh Hickson <[email protected]>
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