New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sftp.rename doesn't behave like OpenSSH's rename #1012
Comments
Excellent question, I don't know off the top of my head what exact protocol messages the SFTP modules use, but it would not surprise me if their initial implementation was slightly off-spec (or if the spec has changed since 2004-ish). Don't have time to deep-dive right now but I can say that if we find you're right and Paramiko's not doing quite the right thing, I'd be open to changing it (probably in a backwards incompat release in case anyone's relying on quirks of the current approach.) Thanks for the report! |
Heh! I just found that the method posix_rename, which was recently added, does this correctly :) |
Sounds like someone already ran into the "oops changing this wouldn't be backwards compat", I guess. Does that basically solve your problem for now? If so I might just mutate this into "replace |
I'm going to be running a test with the customer the following Tuesday, so I'll let you know 100% then if it works for us. But it looks promising, since the inotify events are now the expected ones. |
Hi! I can confirm that posix_rename behaves correctly (like OpenSSH's sftp implementation does). So you can probably go ahead and close this ticket if you want. |
Thanks for the update @mflage ! I'll spin off some new action items (ugh, business-speak) from this. |
I'm not sure if this is a bug or a feature, but when looking at the implementation of the .rename function for the sftp module in Paramiko this doesn't trigger MOVED_FROM and MOVED_TO, instead it triggers CREATE and DELETE events. Is this normal? What is it that paramiko does differently when renaming a file that causes these two events to be created instead of MOVED_FROM and MOVED_TO?
I have tested this with version 2.2.1 of Paramiko. This is the output of 'inotifywait -r -m /tmp/test' which illustrates the difference (the file "test" is uploaded and then renamed to "testfile"):
When using sftp from OpenSSH:
When using paramiko:
The text was updated successfully, but these errors were encountered: