Skip to content

Conversation

@dynamix
Copy link
Contributor

@dynamix dynamix commented Nov 30, 2020

A suggestion to fix #312.

@martindurant
Copy link
Member

What happens if you both have the empty placeholder and nested directories?

This should be tested for the cases that:

  • nothing has been listed yet
  • that the directory in question has been listed
  • that the parent directory has been listed.

With this change, is is still true that info(path) == ls(path)[0] in all cases?

@dynamix
Copy link
Contributor Author

dynamix commented Nov 30, 2020

You mean in case there is /foo and /foo/? Or /foo/ and /foo/bar?

I'll add some test cases at the end of the week, can't answer these out of my head.

At the moment (with or without this PR) the behaviour seems to be incorrect as ls is returning ["foo", "foo"].

@martindurant
Copy link
Member

You mean in case there is /foo and /foo/? Or /foo/ and /foo/bar?

I suppose both those problematic cases :|

ls is returning ["foo", "foo"]

If you do with detail=True, then one of these is presumably the folder, the other the file. So it's not exactly wrong. Whether or not there should be a "/" suffix is another question.

Base automatically changed from master to main February 11, 2021 01:52
@kaushikb11
Copy link

@dynamix @martindurant Any updates on the PR? The inconsistency is causing issues for us while working on remote filesystems. Ref

@martindurant
Copy link
Member

I would like some additional tests for each of the cases I listed above. It's not obvious to me from the code alone that every case will pass.

out0 = [o for o in out if o["name"].rstrip("/") == path]
if out0:
out0 = next((o for o in out if o["name"].rstrip("/") == path), None)
if out0 and out0["name"][-1] != "/" and out0["size"] == 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if out0 and out0["name"][-1] != "/" and out0["size"] == 0:
if out0 and (out0["name"][-1] != "/" or out0["size"] == 0):

Bjoern-Rapp added a commit to Bjoern-Rapp/gcsfs that referenced this pull request Apr 24, 2025
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

Successfully merging this pull request may close these issues.

Pseudo folders break directory detection code in fs.info

3 participants