Skip to content

cmd/go: modfetch.Unzip checks that all filenames are acceptable, causing problems for test fixture directories #26672

Closed
@dgodd

Description

@dgodd

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11beta2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dgodd/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dgodd/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/golang1.11beta2"
GOTMPDIR=""
GOTOOLDIR="/usr/local/golang1.11beta2/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/53/t04mmfdn0qq68l978jgz64cc0000gn/T/go-build523317176=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

If you import a module which includes files which don't pass module.CheckFilePath then you can't use that module. A good example of this is https://github.com/bmatcuk/doublestar. Doublestar has a test directory with several very strangely named files to make sure that it works on such directories. However, that means I can not use go modules to import doublestar

module github.com/dgodd/gomodfilenames

require (
  github.com/bmatcuk/doublestar v1.0.9
)

What did you expect to see?

I expect to be able to import doublestar. I'm not entirely sure what should change. Possibly modules should be able to specify files/directories which will not be imported. If such a system existed then doublestar could state that the test directory should not be extracted by modfetch.Unzip, this seems to me to be good since as a user of the module I don't need it anyway.

I should mention that go get github.com/bmatcuk/doublestar does work.

What did you see instead?

go: extracting github.com/bmatcuk/doublestar v1.0.9
-> unzip /Users/dgodd/go/src/mod/cache/download/github.com/bmatcuk/doublestar/@v/v1.0.9.zip: malformed file path "test/a☺b": invalid char '☺'
go: import "github.com/dgodd/gomodfilenames" ->
	import "github.com/bmatcuk/doublestar": cannot find module providing package github.com/bmatcuk/doublestar

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions