What version of Go are you using (go version)?
$ go version
go version go1.17 linux/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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GOOS="linux"
GOPATH="/home/user/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build2958766942=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Two zips were created with Info-ZIP 3.0 and Writer:
(it was assumed that the archive files may not be identical, but the input files were)
mkdir -p path/to/ dir/
touch path/to/file
chmod 0666 path/to/file dir/
zip info.zip path/to/file dir/
w := zip.NewWriter(os.Stdout)
w.Create("path/to/file")
w.Create("dir/")
w.Close()
We can see that both (according to Reader) have the same permissions: https://play.golang.org/p/SLK2LT1e1Gs
[stdlib] path/to/file: 0o666
[stdlib] dir/: 0o20000000666
[infozip] path/to/file: 0o666
[infozip] dir/: 0o20000000666
Thus we would expect unzip (still Info-ZIP 3.0), to unpack them identically:
[user@localhost ~]$ unzip /path/to/file.zip
Archive: /path/to/file.zip
inflating: path/to/file
creating: dir/
What did you expect to see?
(from info.zip)
[user@localhost ~]$ ls -lR
.:
total 0
drw-rw-rw- 2 user users 40 Dec 31 1979 dir
drwxr-xr-x 3 user users 60 Sep 2 21:45 path
./dir:
total 0
./path:
total 0
drwxr-xr-x 2 user users 60 Sep 2 21:45 to
./path/to:
total 0
-rw-rw-rw- 1 user users 0 Dec 31 1979 file
What did you see instead?
(from stdlib.zip)
[user@localhost ~]$ ls -lR
.:
total 0
drw-r-xr-x 2 user users 40 Dec 31 1979 dir
drwxr-xr-x 3 user users 60 Sep 2 21:45 path
./dir:
total 0
./path:
total 0
drwxr-xr-x 2 user users 60 Sep 2 21:45 to
./path/to:
total 0
-rw-rw-rw- 1 user users 0 Dec 31 1979 file
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Two zips were created with Info-ZIP 3.0 and
Writer:(it was assumed that the archive files may not be identical, but the input files were)
We can see that both (according to
Reader) have the same permissions: https://play.golang.org/p/SLK2LT1e1GsThus we would expect
unzip(still Info-ZIP 3.0), to unpack them identically:What did you expect to see?
(from
info.zip)What did you see instead?
(from
stdlib.zip)