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

info returns something different than ls #1679

Open
mxmlnkn opened this issue Sep 19, 2024 · 1 comment
Open

info returns something different than ls #1679

mxmlnkn opened this issue Sep 19, 2024 · 1 comment

Comments

@mxmlnkn
Copy link
Contributor

mxmlnkn commented Sep 19, 2024

The API specifications states:

Returns a single dictionary, with exactly the same information as ls would with detail=True.

But, this does not hold true for this code:

import pprint
o = fsspec.open("ssh://127.0.0.1")
print("Info of /bin from listdir call")
pprint.pprint([x for x in ol.fs.listdir('/', detail=True) if x['name'] == '/bin'][0])
print("Info of /bin from info call")
pprint.pprint(o.fs.info('/bin'))

The output is:

Info of /bin from listdir call
{'created': 1601554848.8334851,
 'destination': 'usr/bin',
 'gid': 0,
 'ino': 13,
 'islink': True,
 'mode': 41471,
 'mtime': 1601554848.8334851,
 'name': '/bin',
 'nlink': 1,
 'size': 147456,
 'type': 'other',
 'uid': 0}

Info of /bin from info call
{'gid': 0,
 'mtime': datetime.datetime(2024, 9, 6, 10, 25, 16, tzinfo=datetime.timezone.utc),
 'name': '/bin',
 'size': 45056,
 'time': datetime.datetime(2024, 9, 18, 20, 33, 50, tzinfo=datetime.timezone.utc),
 'type': 'directory',
 'uid': 0}

Obviously, this seems to be an issue with handling links, similar to #742. I.e., something like linfo / lstat or a follow_symlinks argument would have to be added to resolve this, and the API text should be updated.

@martindurant
Copy link
Member

Agreed, this appears to be a deficiency of the ssh implementation. Indeed, info does stat, although lstat also exists. I agree that a follow_symlink argument would be useful, if you would like to add 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