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: error if pass a very long args which contains \n character #42295
Comments
What error? Could you share the exact command you run that succeeded with Go 1.14 but failed with Go 1.15? Thanks. |
go link
error if pass a very long args which contains \n
character.
@cherrymui In our case, we need to put a INI config file's content(which contains a lot of '\n') in the -ldflags. It's easy to reproduce it with long -ldflags, I think go should not simply use '\n' as a separator in the response file. |
Can you paste in exact commands you run, and the exact output? Possibly to use The command you mentioned above,
short or long, when I paste it to a shell, never works on my machine with any version of Go. |
Here are two example config files (config-wrong.ini, config.ini):
cmd/link error with go1.15 / config-wrong.ini
get
build success with go1.15 / config.ini
I am not sure if link arg is same on all darwin's machines, so you can add extra lines in |
On darwin, in bash, I was able to reproduce this with: uname -a
The following fails:
But, this succeeds:
And for the people following along at home: |
Change https://golang.org/cl/272870 mentions this issue: |
@jeremyfaller I understand this issue was meant to be moved to NeedsFix state, is that right? When an issue doesn't have any of NeedsInvestigation, NeedsDecision, or NeedsFix labels, it appears as one that hasn't been triaged. |
Sorry, my mistake for not understanding bug life cycles. It's definitely triaged, and I have a fix. We just need to make a decision if it goes into the 1.16 release. |
Change https://golang.org/cl/276555 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?darwin
What did you do?
I build with the following command,
get
go link
error.Then I change the above command with a shorter one,
no
go link
error this time.What did you expect to see?
No
go link
error if I pass a very long args with\n
character inside.My analysis
go1.14 and go1.13 have no such issue.
I notice that go has introduced response file to pass long args in Windows: https://go-review.googlesource.com/c/go/+/110395/7/src/cmd/go/internal/work/exec.go#2483
and enabled it for other OS in go1.15:
go/src/cmd/go/internal/work/exec.go
Line 3131 in f7e2646
response file use
\n
to separate args will cause this issue.The text was updated successfully, but these errors were encountered: