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
According to the recently updated version of the specification the shell style wildcard matching is glob-like, and therefore a path separator in a path should not be matched by a wildcard in the PATHPATTERN.
Current behavior:
A path separator in a path is matched by a wildcard in the PATHPATTERN (fnmatch.fnmatch)
Expected behavior:
A path separator in a path should not be matched by a wildcard in the PATHPATTERN.
Currently the implementation uses fnmatch from the fnmatch module which doesn't distinguish the filename separator ('/' on Unix) as a special character.
The recommended "path-aware" module by the python docs is the glob module. However glob.glob does it by accessing the filesystem and working relative to the current dir (or it needs an absolute path). This behaviour does not work in our case where we need to match relative paths:
Internally glob seems to use fnmatch after having parsed the path segments, maybe implementing similar functionality but treating relative paths as strings, without file system access, could do the job.
Activity
sechkova commentedon Jul 23, 2021
See related issue #1506
sechkova commentedon Jul 28, 2021
Currently the implementation uses fnmatch from the
fnmatchmodule which doesn't distinguish the filename separator ('/' on Unix) as a special character.The recommended "path-aware" module by the python docs is the
globmodule. Howeverglob.globdoes it by accessing the filesystem and working relative to the current dir (or it needs an absolute path). This behaviour does not work in our case where we need to match relative paths:Internally
globseems to usefnmatchafter having parsed the path segments, maybe implementing similar functionality but treating relative paths as strings, without file system access, could do the job.