fsspec / fsspec/filesystem_spec
LocalFileSystem glob removes trailing slash
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
According to the documentation of AbstractFileSystem, glob should act as ls when the path ends with /.
But when using the LocalFileSystem method, the trailing slash is removed when _strip_protocol is called.
Example:
from fsspec.implementations.local import LocalFileSystem
lfs = LocalFileSystem(auto_mkdir=True)
lfs.touch(path="/tmp/data/a.txt")
lfs.touch(path="/tmp/data/b/a.txt")
print(lfs.glob(path="/tmp/data/"))
Output:
['/tmp/data']
Expected output:
['/tmp/data/a.txt', '/tmp/data/b']
A solution would be to completely remove the glob method in the LocalFileSystem class and let the AbstractFileSystem method do the _strip_protocol call (see here)
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 with the LocalFileSystem glob implementation in fsspec/implementations/local.py and compare its path handling with AbstractFileSystem.glob in fsspec/spec.py. Reproduce the trailing-slash example, then verify that glob('/tmp/data/') returns the directory contents shown in the expected output without changing other glob behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100