-
Notifications
You must be signed in to change notification settings - Fork 272
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
Empty files with trailing slash are sometimes treated as directories and sometimes treated as regular files #439
Comments
@martindurant today I was bitten by a similar issue in When I list the contents of from fsspec.core import url_to_fs
fs, path = url_to_fs("s3://modin-datasets/testing/")
# this prints a list including 'modin-datasets/testing/', 'modin-datasets/testing/test_data.parquet', ...
fs.ls('modin-datasets/testing/') but my filesystem doesn't recognize assert not fs.isfile('modin-datasets/testing/') The consequence was that I spent a long time trying to debug why s3fs was trying to treat my directory as a file, until I finally realized it was just trying to open a file it correctly found, but then could no longer recognize as a file! Indeed, Is this a bug in s3fs? Is it a separate issue? How does it relate to #562? |
There are a few ideas in conflict with this kind of thing, where a file and directory have exactly the same name, including the trailing "/". This situation could not, of course, happen on a posix FS. The ls method is designed to provide a list of outputs, and so the same name can appear twice, with different details. However, info only fetches one of these, and isfile/dir uses info.
|
The code above first creates an empty file using that ends with a trailing slash. Then it tries to run s3fs's ls on the parent directory, which identifies that file as a directory;
Also the second and the third calls (info() and isdir()) claims it is a directory;
though when we try to do ls/walk etc it behaves like a file. The following is the result of
.ls('bucket/empty-dir/')
;instead I would have expected it to return an empty list
The text was updated successfully, but these errors were encountered: