Repository navigation
fix: list the home directory - #106
Merged
Merged
Conversation
sshfs uses "" for the home directory, but ls and info sent it to the
server as is, and an empty path isn't valid there: OpenSSH's
sftp-server fails with ENOENT. So ls(""), info("") and
ls("ssh://host") raised FileNotFoundError, and find("") returned
nothing. They now send ".", which servers resolve to the home
directory. Listing names stay relative, and info("") keeps the name ""
so it isn't confused with "/".
Fixes #105.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 29, 2026
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the SSH home-directory path handling change.
No open issues 🎉
What changed in this PR
Fixes #105 by allowing SSH filesystem operations to access the home directory through an empty path while keeping returned names distinct from the filesystem root.
Changes:
- Sends
"."to the SFTP server for empty paths in_lsand_info. - Preserves relative listing names and the empty home-directory name in metadata.
- Adds regression coverage for empty-path and host-only URL listings, home-directory traversal, and metadata.
| File | Description |
|---|---|
| tests/test_sshfs.py | Adds regression tests for home-directory access and returned names. |
| sshfs/spec.py | Normalizes empty server paths to "." while preserving home-directory naming. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sshfs uses
""for the home directory:_strip_protocol("ssh://host")returns"", and relative paths resolve against it. Butlsandinfosent""to the server unchanged, and an empty path isn't valid there. OpenSSH's sftp-server fails withENOENT, so onmain:_lsand_infonow send"."for"", which servers resolve to the home directory. Listing names stay relative (a.txt), andinfo("")keeps the name"", so it isn't confused with the root,"/".Checked against OpenSSH 10.0 in Docker. The test fails on
mainagainst the test server too, which rejects""the same way.Fixes #105.
🤖 Generated with Claude Code