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

Go modules set gozstd directory to 0555, causing "make clean libzstd.a" to fail #6

Open
pmer opened this issue Feb 12, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@pmer
Copy link

pmer commented Feb 12, 2019

Issue

make clean libzstd.a fails with a file system permission error if using Go modules as implemented in Go 1.11. The make clean target tries to remove the libzstd_target file, but Go has set the current directory to Unix permission 0555, which does not allow removing files.

Specifically:

$ make clean libzstd.a
rm -f libzstd_darwin.a
rm: libzstd_darwin.a: Permission denied
make: *** [clean] Error 1

Seems that with the move to modules, the Go project is taking an aggressive stance on this. Their deciding reason is that this, in particular, prevents unit tests, which are run from their containing directory, from modifying the contents of their directory.

See golang/go#27161.

Expected

Either make clean libzstd.a succeeds or there is some workaround.

Steps to reproduce

Bash script:

export GOPATH=/tmp/go
mkdir $GOPATH
cd $GOPATH
mkdir main
cd main
cat > main.go <<EOF
package main

import "github.com/valyala/gozstd"

func main() {
    dst := make([]byte, 1024)
    src := make([]byte, 1024)
    gozstd.Compress(dst, src)
}
EOF
cat > go.mod <<EOF
module main

require github.com/valyala/gozstd v1.2.1
EOF
go get
cd $GOPATH/pkg/mod/github.com/valyala/gozstd@v1.2.1
make clean libzstd.a
@valyala valyala added the bug Something isn't working label Feb 12, 2019
@pmer
Copy link
Author

pmer commented Feb 15, 2019

Another situation where files are not writable, albiet for a different reason. This one because the files are owned by a different user.

golang/go#30185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants