fsspec / fsspec/filesystem_spec

info returns something different than ls

Open
#1,679 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AbstractArchiveFileSystem API specification and the SSH filesystem entry points used by listdir(detail=True) and info(), then compare their handling of symbolic links with the behavior discussed in #742. Determine whether linfo/lstat or a follow_symlinks argument is appropriate, update the API text, and verify that the two calls report consistent link information.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.