Skip to content

cmd/go mishandles build metadata separator #28647

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

Closed
mellis opened this issue Nov 7, 2018 · 4 comments
Closed

cmd/go mishandles build metadata separator #28647

mellis opened this issue Nov 7, 2018 · 4 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mellis
Copy link
Contributor

mellis commented Nov 7, 2018

What version of Go are you using (go version)?

$ go version
go version go1.11 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/micellis/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/micellis/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5n/cs1hx8q170v2741s2whxhc10pnl463/T/go-build108446644=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go get example.com/foo/[email protected]+meta.sha256

Note the build metadata is not ignored when attempting to retrieve the info file.

What did you expect to see?

go: finding example.com/foo/bar v1.0.0
go: finding example.com/foo v1.0.0
go: finding example.com v1.0.0
go get example.com/foo/[email protected]+meta: unexpected status (http://localhost:8000/example.com/foo/bar/@v/v1.0.0.info): 404 File not found

What did you see instead?

go: finding example.com/foo/bar v1.0.0+meta.sha256
go: finding example.com/foo v1.0.0+meta.sha256
go: finding example.com v1.0.0+meta.sha256
go get example.com/foo/[email protected]+meta.sha256: unexpected status (http://localhost:8000/example.com/foo/bar/@v/v1.0.0+meta.sha256.info): 404 File not found
@mellis
Copy link
Contributor Author

mellis commented Nov 7, 2018

The issue is due to the internal/semver/semver.go package not recognizing the separator character '.' in the parseBuild function.

Have a small fix, just want to confirm this isn't expected (doesn't appear to be looking at the function and similar function parsePrerelease)

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/148835 mentions this issue: cmd/go: Fix parsing multiple build metadata

@bcmills bcmills added NeedsFix The path to resolution is known, but the work has not been done. modules labels Nov 19, 2018
@bcmills bcmills added this to the Go1.12 milestone Nov 19, 2018
bradfitz pushed a commit that referenced this issue Nov 21, 2018
Per https://semver.org/#spec-item-10, build metadata may include
a series of dot separated identifiers.

Fixes #28647

Change-Id: I98655c62584a822953df71fba32b4a2cafe7a04b
Reviewed-on: https://go-review.googlesource.com/c/148835
Reviewed-by: Bryan C. Mills <[email protected]>
@thepudds
Copy link
Contributor

@mellis The behavior here changed again recently in #31713.

It would be interesting to hear if you now see behavior that works for you if try tip. (An easy way to get tip is go get golang.org/dl/gotip && gotip download).

Also, did you have an example of a public repository where this was a problem, or was it a private repo where you first saw this as a problem?

@mellis
Copy link
Contributor Author

mellis commented May 14, 2019

I originally noticed the behaviour when experimenting with module support for our internal repositories and build system.

We've changed strategies since then though, so this particular issue isn't affecting us any more.

@golang golang locked and limited conversation to collaborators May 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants