Skip to content

archive/zip: AddFS omits trailing slash in directory names #71235

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
jba opened this issue Jan 12, 2025 · 6 comments
Closed

archive/zip: AddFS omits trailing slash in directory names #71235

jba opened this issue Jan 12, 2025 · 6 comments
Labels
BugReport Issues describing a possible bug in the Go implementation. FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@jba
Copy link
Contributor

jba commented Jan 12, 2025

Go version

go version go1.24-20241213-RC00 cl/706019355 +e39e965e0e X:fieldtrack,boringcrypto linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE='on'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/usr/local/google/home/jba/.cache/go-build'
GODEBUG=''
GOENV='/usr/local/google/home/jba/.config/go/env'
GOEXE=''
GOEXPERIMENT='fieldtrack,boringcrypto'
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2446417499=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/usr/local/google/home/jba/repos/go/src/go.mod'
GOMODCACHE='/usr/local/google/home/jba/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/usr/local/google/home/jba/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org'
GOROOT='/usr/lib/google-golang'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/usr/local/google/home/jba/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/google-golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24-20241213-RC00 cl/706019355 +e39e965e0e X:fieldtrack,boringcrypto'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

The doc for zip.FileHeader.Name says "A trailing slash indicates that this file is a directory."
When change https://go.dev/cl/578415 added directories, it did not include the trailing slashes.

repro: https://go.dev/play/p/9C5y2uZ1A2U?v=gotip

What did you see happen?

dir
dir/file

What did you expect to see?

dir/
dir/file

@gabyhelp gabyhelp added the BugReport Issues describing a possible bug in the Go implementation. label Jan 12, 2025
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Jan 12, 2025
@dmitshur dmitshur added this to the Go1.24 milestone Jan 12, 2025
@dmitshur
Copy link
Member

CC @songgao, @ianlancetaylor.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/642375 mentions this issue: archive/zip: dir add slash

@h9jiang
Copy link
Member

h9jiang commented Jan 15, 2025

As hana pointed out, this issue might be related to the issue happens in vscode-go causing the test failure.

CL 642479

I'm not very familiar with the go release process (about code freeze). Is this CL going to merge in gotip and released in go 1.24? (If it can merge in gotip, I will just drop my CL and wait for the fix here)

@jba
Copy link
Contributor Author

jba commented Jan 15, 2025

@h9jiang it will be in 1.24.

@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Jan 22, 2025
callthingsoff added a commit to callthingsoff/go that referenced this issue Jan 24, 2025
This takes over CL 642375.

Fixes golang#71235.

Change-Id: Ic88654da5ae80911bc28329e008de1396c97856e
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/644075 mentions this issue: archive/zip: add trailing slash to directory names for Writer.AddFS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugReport Issues describing a possible bug in the Go implementation. FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
5 participants