filesystem_spec
filesystem_spec copied to clipboard
info returns something different than ls
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.