Commit df852af
fix: preserve absolute root in _strip_protocol so walk("/") works (#69)
* fix: preserve root path in _strip_protocol so walk('/') works
SSHFileSystem inherited the default root_marker of "", so
_strip_protocol("/") collapsed the root to an empty string. walk("/")
then listed the home directory and produced relative paths that were
not considered to exist. Set root_marker = "/" to keep the root, and
add walk tests covering a nested tree and the root case.
* Address review
* tests: make test_walk_root deterministic
The mock server exposes the host's real filesystem, so assertions about
the contents of "/" depend on machine state: mock-ssh-server stats
every entry of a listing, so a single dangling symlink at the host root
fails the whole readdir, and fsspec's walk(on_error="omit") swallows
the error, silently turning the name/exists assertions into a no-op.
Assert only the yielded root, which distinguishes the fix (root "/")
from the regression (root "") on every machine. Also correct the
failure-mode note: most servers (e.g. OpenSSH) reject an empty path
with ENOENT outside REALPATH; servers implementing the SFTP draft's
empty-path rule resolve it to the default directory instead.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* tests: replace walk-based root test with stat-based assertions
test_walk_root listed the host's real root through the mock server:
mock-ssh-server stats every entry of a listing, so a single dangling
symlink at "/" fails the whole readdir. On older fsspec releases
(e.g. 2025.10.0, which Python 3.9 resolves) walk() yields nothing when
the listing fails, so next() raised StopIteration -- the
macos-latest/3.9 CI failure. Assert root resolution via stat instead,
which depends neither on the contents of "/" nor on the fsspec
version.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Ivan Shcheklein <shcheklein@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 29d3f6c commit df852af
2 files changed
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
259 | 298 | | |
260 | 299 | | |
261 | 300 | | |
| |||
0 commit comments