-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/link/internal/ld: testcarchive fails on Windows with MinGW: doesn't handle "\r" in output #68121
Comments
Change https://go.dev/cl/593916 mentions this issue: |
Change https://go.dev/cl/594855 mentions this issue: |
I realized that a cherry-pick is necessary to fix this in 1.23, so took a look at https://go.dev/wiki/Go-Release-Cycle#timeline, and I think what I need to do is open a cherry-pick CL and reopen this issue because it still applies to 1.23. |
@dagood a cherry-pick may not be necessary. The main branch is not opened for general development, so everything in the main branch should be still included in Go 1.23. We may just do a merge to release branch, instead of cherry-picking each CL. Thanks. |
Fix the "gcc --print-prog-name" output parser to handle "\r\n", not only "\n". The MinGW compiler on Windows uses "\r\n" as line endings, causing the existing parser to create paths like ".../x86_64-w64-mingw32/bin/ar.exe\r", which is not correct. By trimming the "\r\n" cutset, both types of line endings are handled correctly. Fixes golang#68121 Change-Id: I04b8bf9b6a5b29a1e59a6aa07fa4faa4c5bdeee6 Reviewed-on: https://go-review.googlesource.com/c/go/+/593916 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com>
Go version
go version go1.23rc1 windows/amd64
Output of
go env
in your module/workspace:What did you do?
Also repros with
go version devel go1.23-0af2148fdc Fri Jun 21 21:01:30 2024 +0000 windows/amd64
(latest master, 0af2148)What did you see happen?
Note:
bin/ar.exe\r": file does not exist
.I'm not sure if all builds of MinGW use
\r\n
in their output, but I confirmed that a few other versions also fail in the same way:go/src/cmd/link/internal/ld/lib.go
Lines 2911 to 2922 in 0af2148
Changing the
strings.TrimSuffix
tostrings.TrimRight(string(out), "\r\n")
fixes the test.I'm planning to send a CL but need to dust off the contrib tools. 🙂Submitted https://go-review.googlesource.com/c/go/+/593916 with this change.What did you expect to see?
Success.
The text was updated successfully, but these errors were encountered: