Skip to content
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

ngclient: implement glob-like pattern matching #1505

Closed
sechkova opened this issue Jul 22, 2021 · 2 comments · Fixed by #1512
Closed

ngclient: implement glob-like pattern matching #1505

sechkova opened this issue Jul 22, 2021 · 2 comments · Fixed by #1512

Comments

@sechkova
Copy link
Contributor

Description of issue or feature request:

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.

@sechkova
Copy link
Contributor Author

sechkova commented Jul 23, 2021

See related issue #1506

@joshuagl joshuagl added the backlog Issues to address with priority for current development goals label Jul 28, 2021
@joshuagl joshuagl added this to the Sprint 5 milestone Jul 28, 2021
@sechkova
Copy link
Contributor Author

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.

@jku jku modified the milestones: Sprint 5, Sprint 6 Aug 18, 2021
@joshuagl joshuagl removed the backlog Issues to address with priority for current development goals label Aug 18, 2021
@jku jku closed this as completed in #1512 Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants