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: Rel() fails for UNC volumes when trailing slash is omitted #41230
Comments
I wrote a failing test here: https://go-review.googlesource.com/c/go/+/253197
cc @niemeyer |
Thank you for your report. I suspect we never implemented Rel bits for UNC rooted paths. I don't have time to do it now. But I will review contribution. Generally, you should not use Rel on windows. For example, filepath.Rel is broken when we walking from one drive to another. It has no meaning for something like filepath.Rel(c:\a, d:\a\b). Alex |
Thanks! I understand the limitations of My CL only contains a failing test. I did attempt to make it pass but I wasn't sure where best to fix this case. |
I could use some advice on the best way to make this failing test pass. |
Sorry, I'm not sure quite what you are asking. It seems that you've found a bug in the path/filepath package. Are you asking how to modify the package so that your test passes? |
Yea I'm just confused about where is best to fix this. It's not clear to me if the bug lies in |
I updated my CL with the dumbest possible thing I could do to make the test pass. It still feels like I'm missing a simpler solution, but maybe a special case is the best. https://go-review.googlesource.com/c/go/+/253197 If someone wants to experiment, here's a playground link with all the windows-specific code paths: https://play.golang.org/p/GhDba2BSex9 |
I think the right place to fix this is I commented on your CL. Thanks. |
Change https://golang.org/cl/253197 mentions this issue: |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Expected both invocations of
filepath.Rel
to return the same relative pathWhat did you see instead?
First invocation returns an error
cc @alexbrainman
The text was updated successfully, but these errors were encountered: