Skip to content
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/go: go get (unzip) cannot handle unicode path #32617

Closed
leitzler opened this issue Jun 14, 2019 · 2 comments
Closed

cmd/go: go get (unzip) cannot handle unicode path #32617

leitzler opened this issue Jun 14, 2019 · 2 comments

Comments

@leitzler
Copy link
Contributor

leitzler commented Jun 14, 2019

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

$ go version
go version go1.12.6 linux/amd64

Does this issue reproduce with the latest release?

Yes (and tip)

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/leitzler/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/leitzler/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/tmp/tmp.OCzVOwKWBd/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build567694577=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Tried to fetch a third party dependency that contained a folder/file with unicode chars.

To reproduce I've created a repo that contains a folder & file with a unicode char, in package:
github.com/modsdemo/unicode/🦡

It can be used in a Go program, but can't be fetched using go get since unzip will fail to extract it:

$ cd $(mktemp -d) && go mod init x
$ go get github.com/modsdemo/unicode
go: finding github.com/modsdemo/unicode latest
go: downloading github.com/modsdemo/unicode v0.0.0-20190614083133-991638b734de
go: extracting github.com/modsdemo/unicode v0.0.0-20190614083133-991638b734de
-> unzip /home/leitzler/go/pkg/mod/cache/download/github.com/modsdemo/unicode/@v/v0.0.0-20190614083133-991638b734de.zip: malformed file path "\U0001f9a1/\U0001f9a1.go": invalid char '\U0001f9a1'
package github.com/modsdemo/unicode: unknown import path "github.com/modsdemo/unicode": unzip /home/leitzler/go/pkg/mod/cache/download/github.com/modsdemo/unicode/@v/v0.0.0-20190614083133-991638b734de.zip: malformed file path "\U0001f9a1/\U0001f9a1.go": invalid char '\U0001f9a1'

What did you expect to see?

The dependency fetched

What did you see instead?

Unzip failing to extract the module zip

@cuonglm
Copy link
Member

cuonglm commented Jun 14, 2019

See

// Safe encodings

@FiloSottile
Copy link
Contributor

Closing as duplicate of #29101, please let me know if you think that's not correct.

@golang golang locked and limited conversation to collaborators Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants