-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
path/filepath: regression in EvalSymlinks wrt ending slash #29372
Comments
Forgot to add that this was probably introduced by 7d27e87 (aka https://go-review.googlesource.com/121676). Checked that the case of existing directory with the ending slash works fine; it's just for files so maybe not a regression but an (accidental) fix? This should be at least described in release notes, and I guess a test case needs to be added. |
@kolyshkin I think it fixed the bug accidentally but introduce new bug. Indeed, The later check then returns confusing error in this case. |
While this is definitely a change, I have to say that returning an error for I agree that it would be better to return not-a-directory. |
Change https://golang.org/cl/155597 mentions this issue: |
On Windows, it isn't fixed yet. Which why my tests added in CL failed on Windows. I updated CL to do extra check before |
In our case it was just a unit test case (and I hope no real production code depends on such behavior of EvalSymlinks).
That would actually fix the above unit test! |
I strongly support returning |
Change https://golang.org/cl/155997 mentions this issue: |
Change https://golang.org/cl/156398 mentions this issue: |
CL 155597 attempted to fix #29372. But it failed to make all new test cases pass. Also CL 155597 broke some existing code (see #29449 for details). Make small adjustment to CL 155597 that fixes both #29372 and #29449. Suggested by Ian. Updates #29372 Fixes #29449 Change-Id: I9777a615514d3f152af5acb65fb1239e696607b6 Reviewed-on: https://go-review.googlesource.com/c/156398 Run-TryBot: Alex Brainman <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
Summary
In Go versions prior to 1.12-beta1, a call to filepath.EvalSymlinks() with an argument like
"/path/to/existing/file/"
results in no error and the trailing slash removed. With 1.12-beta1, it gives "file does not exist". Complete example here: https://play.golang.org/p/YmfDC5IcWMFWhether the old behavior was deliberate or accidental, this looks like a regression.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes (beta)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Complete example: https://play.golang.org/p/YmfDC5IcWMF
What did you expect to see?
No error, trailing slash removed:
What did you see instead?
"file does not exist" error with no context:
The text was updated successfully, but these errors were encountered: