fsspec / fsspec/filesystem_spec
glob reads irrelevant directories; can fail on permissions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
The implementation of glob calls find on the maximal path not including magic, which reads all files in the matching subdirectories, possibly up to a maximal depth.
This is a large pessimization, both on performance and on permissions:
- Say the glob path is
/data/year=*/month=1/*.csv, and each "year" directory has 12 "month" subdirectories. Currently glob will read x12 directories more than it needs to, since it will reads all month subdirectories before pattern matching. - Say the glob path is
/users/year=*/user=drorspei/*, where each "year" directory has many user directories, and I only have permissions to list my own user's files. Then glob can fail since it will try to list files in subdirectories which I don't have permissions for. This won't happen on all "filesystems", but on something like S3 it's common to haveList*permissions on some prefixes and not others.
Is it possible for glob to read only the subdirectories that match the pattern?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the glob entry point and the implementation path where it calls find on the maximal path before magic-pattern matching. Trace how matching subdirectories are selected, then verify that irrelevant directories are not listed and that permission-limited prefixes do not cause glob to fail, using the repository's existing glob tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100