Skip to content

Allow inspecting SFTP symlinks without following them - #2298

Open
ska2704 wants to merge 1 commit into
fsspec:masterfrom
ska2704:fix-sftp-symlink-info
Open

ska2704 wants to merge 1 commit into
fsspec:masterfrom
ska2704:fix-sftp-symlink-info

Conversation

@ska2704

@ska2704 ska2704 commented Oct 15, 2026

Copy link
Copy Markdown

Fixes #1679.

SFTP info() always follows symlinks, so it cannot return the link metadata shown by a detailed directory listing or inspect a dangling link. Add follow_symlinks=False to use Paramiko's lstat(). The default remains True, preserving existing behavior.

Regression tests cover links to files, directories and missing targets, with bare paths and both SFTP/SSH URL schemes. They compare link metadata with ls(detail=True) and check that regular paths and the default behavior are unchanged. The option is included in the API documentation and changelog.

Validation on Python 3.12:

  • Unchanged SFTP module: 11 passed, 17 skipped. All nine new regression cases fail before the change and pass with it.
  • SFTP, local filesystem, filesystem specification, core and API tests: 664 passed, 108 skipped, 2 xfailed.
  • pre-commit run --all-files: passed.
  • sphinx-build -b html -W --keep-going docs/source ../fsspec-docs: passed.
  • An additional local integration check passed using real Paramiko SSH/SFTP clients and a Paramiko SFTP server over a socket pair, with actual file, directory and dangling symlinks.

The existing 17 Docker-based SFTP tests were skipped because Docker is unavailable locally. Other skips cover optional backends and platform-specific cases. Windows and the full optional-backend suite were not run locally.

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.

info returns something different than ls

1 participant