-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: Glob fails if it has a wildcard and ends with / #33617
Comments
The function first uses filepath.Split to get the parent directory of the given path. When a trailing slash is present, filepath.Split returns the path as it is as it can't split it further. The fix is to clean the path before calling filepath.Split Lines 242 to 248 in 0212f04
|
Hello @BlackHole1, thank you for the report! |
The Glob tries to get the parent directory of the given directory. When a trailing slash is present, filepath.Split returns the path as it is as it can not split it further. This fix cleans the path first by remoivng any trailing slash before getting the parent directory. Fixes golang#33617
Change https://golang.org/cl/207837 mentions this issue: |
I don't understand this issue report. The docs for What is the actual bug here? Where do the functions not act as documented? |
With or without the slash in the trailing, I think the matching result should be the same, but it is not the case. |
The documentation for What do you think |
I think their output should be the same. The last slash should not affect the match. The Although I didn't find the relevant instructions in the above document, I tried several shells, and the results of their matching have nothing to do with the last slash. |
I have a file
So I don't agree with you that the last slash does not affect the match. It does affect it. |
It seems that if it is a file at the end, it is influential. But when the last is the directory, there is no affect.
|
So it seems that we need to decide whether |
I would like to confirm whether to modify |
I don't see how it is possible to change (That is of course an argument for not changing |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/hOALcoEmrWz
What did you expect to see?
Accurate return path
What did you see instead?
Cannot match when there is a wildcard in the path and the last character is /
Other
The text was updated successfully, but these errors were encountered: