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

the glob() method does not follow symlinks #1674

Open
danol-px opened this issue Sep 16, 2024 · 1 comment
Open

the glob() method does not follow symlinks #1674

danol-px opened this issue Sep 16, 2024 · 1 comment

Comments

@danol-px
Copy link

This results in different behaviour vs other glob methods in e.g. glob or pathlib:

from fsspec.implementations.local import LocalFileSystem
import glob

fs = LocalFileSystem()
fs.mkdir('original/target_dir')
fs.mkdir('new')
fs.touch('original/target_dir/example_file.txt')
fs.symlink('original/target_dir', 'new/link')

print(fs.glob('original/*/example_file.txt'))
print(fs.glob('new/*/example_file.txt'))
print(glob.glob('new/*/example_file.txt'))

Output:

[original/target_dir/example_file.txt']
[]
['new/link/example_file.txt']
@danol-px danol-px changed the title glob() does not traverse symlinks the glob() method does not follow symlinks Sep 17, 2024
@martindurant
Copy link
Member

fsspec tries to be have the same generic behaviour across different storage backends, and I suppose we haven't considered links (which only exist for local). I assume that something in LocalFileSystem can be tunes to account for links, if you would like to look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants