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: build golang.org/x/vuln/osv.test fails when -gcflags=all='-N -l' is provided #50200
Comments
Yeah, it seems from the linker. I'll take a look. It might be related to that the package name starts with "go." and doesn't contain a slash. "go." has been a magic name that the compiler uses for its own synthetic symbols. |
This is problem again with our special case in types.NewPkg for packages with the "go." prefix. If I disable that special treatment in NewPkg for packages beginning with "go.", then everything works. @randall77 , should we make the check directly specific to "go.shape" and the other builtin packages? I feel like we don't have set rules about what can appear in a package path, so an unspecific check may never be quite right. In particular, I see in go.opencensus.io/internal/check/version.go, you can have an import with no path separator (slash):
|
I'm a little surprised that it worked before. |
The current builtin package names/paths that start with "go." seem to be: go.builtin, go.runtime, go.itab, and now go.shapes. We have special code in NewPkg not to escape package paths beginning with "go.", because we don't want all the shape type names with the period being escaped, as in |
Is the import above
supposed to be illegal? I'm not sure we have set rules. |
No. I think it is technically legal. "go." has been a magic name for a long time. I'm just surprised that it didn't tripped anything until 1.18. |
Then I think we probably need to make the check specific to "go.shape" only. We could do it for all builtin packages, but the paths for the other builtin packages don't show up in the debugger like "go.shape" shows up in the names for shape types. We only added this special check for 1.18 (to make the shape type names nicer). |
Could we do what this comment suggests? |
I think we probably want to focus specifically on "go.shape", which is the only one we care about. Using printfs, I see that go.builtin has a path of "go.builtin", name "" So, if we check for a dot in the name, we wouldn't be getting all the built-in packages, we would be just getting go.itab and go.shape. So, to me, it seems like we should just check for "go.shape" directly. |
Change https://golang.org/cl/372934 mentions this issue: |
Not sure if the problem is the compile command or the link command as it appears while running link.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Reproducible only with go1.18beta1
Not observed with go1.17.X
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Checkout golang.org/x/vuln @ 5e054cb
What did you expect to see?
Test passes in both cases.
What did you see instead?
Test fails due to build failure if the -gcflags value is supplied.
(And cannot run
dlv test
)go test -gcflags=all='-N -l' -x
outputI think the bug appears with
-l
.The text was updated successfully, but these errors were encountered: