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: TestErrIsNotExist in error_test.go is not robust #45407

Closed
perillo opened this issue Apr 6, 2021 · 2 comments
Closed

os: TestErrIsNotExist in error_test.go is not robust #45407

perillo opened this issue Apr 6, 2021 · 2 comments

Comments

@perillo
Copy link
Contributor

@perillo perillo commented Apr 6, 2021

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

$ go version
go version go1.16.3 linux/amd64

In the testErrNotExist function, the code calls os.Chdir expecting to fail, but does not restore the original working directory in the case where it does not fail. The following code however assumes that os.Chdir may not fail.

@dmitshur dmitshur added this to the Backlog milestone Apr 6, 2021
@bcmills bcmills added the help wanted label Apr 7, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 9, 2021

Change https://golang.org/cl/308849 mentions this issue: os/os_test: make testErrNotExist return to cwd if os.Chdir succeeds

@gh4n
Copy link

@gh4n gh4n commented Apr 9, 2021

Had a go at fixing this, would appreciate any/all feedback

@gopherbot gopherbot closed this in 841bc14 Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants