You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Attempt to use filepath.Glob() with a pattern that will match directories the user
does not have permission to access. For example, "/proc/*/fd/*", which
includes protected directories about processes of other users.
What is the expected output?
Glob, as with the standard POSIX function and the Python implementation, should ignore
directories it cannot open and continue looking for files/directories that match the
pattern.
What do you see instead?
When Glob reaches a directory it lacks permissions to stat properly, it does not
continue searching.
Which compiler are you using (5g, 6g, 8g, gccgo)?
8g
Which operating system are you using?
Linux
Which revision are you using? (hg identify)
c5c62aeb6267 tip
Please provide any additional information below.
The problem lies in match.go glob(). It is supposed to append additional matches to the
given matches []string. However, if the stat fails, the given directory cannot be
confirmed to be a directory (particularly because the user lacks permissions to treat it
as one), or Readdirnames fails, it returns nil, getting rid of the original matches
array. For my example pattern "/proc/*/fd/*", IsDirectory() returns false,
which causes the problem.
I've attached a patch which simply replaces the three instances of "return
nil" with "return matches".
Also when you create the changelist, please add the line "Fixes issue #1610." (verbatim)
to the change description. That will associate the fix with this issue.
Thanks.
by mikesech:
Attachments:
The text was updated successfully, but these errors were encountered: