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: error return by os.RemoveAll is not compatible with os.IsNotExist #7776

Closed
davecheney opened this issue Apr 14, 2014 · 5 comments
Closed
Milestone

Comments

@davecheney
Copy link
Contributor

What steps will reproduce the problem?
1. http://play.golang.org/p/2oDie7N4Hd

What is the expected output? What do you see instead?

Expected: the workers race to delete the directory tree, there is a high probability
that some will race to delete a directory that has already been deleted. In that case
os.IsNotExist() should identify the error

Got:

lucky(~/devel/issue) % go run issue.go 
2014/04/14 11:07:18 creating temporary directories rooted at
"/tmp/issue866430634"
2014/04/14 11:07:18 preparing workers
2014/04/14 11:07:18 release the swarm
2014/04/14 11:07:19 unexpected error: *os.SyscallError, "readdirent: no such file
or directory"
2014/04/14 11:07:19 unexpected error: *os.SyscallError, "readdirent: no such file
or directory"
2014/04/14 11:07:19 unexpected error: *os.SyscallError, "readdirent: no such file
or directory"

Please use labels and text to provide additional information.

Because syscall.ENOENT is wrapped in an *os.SyscallError the check in error_unix.go
fails.
@minux
Copy link
Member

minux commented Apr 14, 2014

Comment 1:

error wrapping is (always) a problem for Go packages.
similar bug(s) are also reported for the net package.
should we fix it for Go 1.3?
I think we probably should do an extensive audit
of all OS-interfacing packages for similar problems
in Go 1.4.

Labels changed: added release-go1.3maybe, repo-main.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented May 9, 2014

Comment 2:

Labels changed: added release-go1.4, removed release-go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 3:

RemoveAll is never supposed to return an IsNotExist error. Will fix.

@gopherbot
Copy link

Comment 4:

CL https://golang.org/cl/145860043 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Sep 18, 2014

Comment 5:

This issue was closed by revision 98a5f52.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#7776.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, r
https://golang.org/cl/145860043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Fixes golang#7776.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, r
https://golang.org/cl/145860043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
Fixes golang#7776.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews, r
https://golang.org/cl/145860043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants