Repository navigation
Conversation
posix_rename is an SFTP extension. When a server lacks it, mv ran cp over an SSH exec channel, which SFTP-only servers reject. Plain rename is in the base protocol, so try it first and keep the copy for the case it can't cover: a target that already exists.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
+ Coverage 94.30% 94.52% +0.21%
==========================================
Files 13 13
Lines 738 949 +211
==========================================
+ Hits 696 897 +201
- Misses 42 52 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #40.
When the server doesn't support the
posix-renameextension,mvfalls back to runningcpover an SSH exec channel. Servers that only allow SFTP refuse that, somvfails there (theChannelOpenError: Session request failedfrom the issue).Plain SFTP
renameis part of the base protocol, so this tries it before the copy. Unlikeposix_renameit doesn't replace an existing target, and servers answer that withSFTPFailure(v3) orSFTPFileAlreadyExists(v5+); only those two fall through to the copy + delete. Other errors (missing source, permissions) raise as before.Tests:
test_move_sftp_rename_fallback: withposix_renameunsupported,mvrenames without calling_cp_file. Fails on main.renamerefuse, so they keep covering the copy path.pytest tests/test_sshfs.py: 97 passed (python:3.12 Linux container, since mock-ssh-server is Linux only).