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

os: RemoveAll possible regression with empty path #28830

Closed
mhilton opened this issue Nov 16, 2018 · 3 comments
Closed

os: RemoveAll possible regression with empty path #28830

mhilton opened this issue Nov 16, 2018 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@mhilton
Copy link

mhilton commented Nov 16, 2018

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

$ go version
go version devel +14608976db Thu Nov 15 23:37:20 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

No - release 1.11.2 behaves as before

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

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

What did you do?

package main

import (
	"fmt"
	"os"
)

func main() {
	err := os.RemoveAll("")
	fmt.Printf("%v\n", err)
}

What did you expect to see?

Go 1.11.2 has the output <nil> - indicating no error returned

What did you see instead?

Tip has the output invalid argument - indicating syscall.EINVAL

@rogpeppe
Copy link
Contributor

rogpeppe commented Nov 16, 2018

Even if it was decided that it's appropriate for os.RemoveAll to return an error in this case, it should probably return an os.PathError rather than the unwrapped syscall error.

@mvdan mvdan added this to the Go1.12 milestone Nov 16, 2018
@mvdan mvdan added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 16, 2018
@ianlancetaylor ianlancetaylor added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Nov 16, 2018
@gopherbot gopherbot removed the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 16, 2018
@ianlancetaylor
Copy link
Contributor

We should not change this behavior. Patches welcome.

@gopherbot
Copy link

Change https://golang.org/cl/150158 mentions this issue: os: make RemoveAll("") fail silently on unix

bradfitz pushed a commit that referenced this issue Nov 21, 2018
CL 146020 changed the behavior of RemoveAll("") on unix systems using
the *at functions to return syscall.EINVAL instead of nil. Adjust the
*at implementation to retain this behavior as is the case on the *noat
systems.

Additionally, also make sure RemoveAll("") on systems not using the "at
functions (e.g. nacl and js/wasm) follow the same behavior (which wasn't
the case previously).

Fixes #28830

Change-Id: I8383c1423fefe871d18ff49134a1d23077ec6867
Reviewed-on: https://go-review.googlesource.com/c/150158
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
@golang golang locked and limited conversation to collaborators Nov 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants