-
Notifications
You must be signed in to change notification settings - Fork 489
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
New workaround renamexdev to enable moving files across remote FS #118
Conversation
e93df06
to
7a1d210
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Just some small nitpicks to address.
sshfs.c
Outdated
SSHFS_OPT("buflimit", buflimit_workaround, 1), | ||
SSHFS_OPT("nobuflimit", buflimit_workaround, 0), | ||
SSHFS_OPT("fstat", fstat_workaround, 1), | ||
SSHFS_OPT("nofstat", fstat_workaround, 0), | ||
FUSE_OPT_END |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all these spurious changes.
sshfs.rst
Outdated
Permission denied when moving files across remote filesystems | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
SSH servers return a generic error when failing to rename across filesystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add "some" (unless this is actually standard behavior, in that case please provide a link to the standard)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comes from the code (none of the 8 defined SSH_FX_* return codes describe EXDEV) and from the web at https://winscp.net/eng/docs/sftp_codes "Most SSH/SFTP servers support only SFTP version 3 that defines only codes 0 to 8." (Note that even amongst the "extended" error codes none describe EXDEV). So I changed it to "Most SSH servers".
sshfs.rst
Outdated
SSH servers return a generic error when failing to rename across filesystem | ||
boundaries (EXDEV). sshfs normally considers it a permission denied error | ||
(EPERM). If the option `-o workaround=renamexdev` is given, generic failures | ||
will be considered EXDEV errors which will make a move program attempt to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use "programs like mv" instead of "a move program"
7a1d210
to
3016689
Compare
You may consider enabling the workaround by default, similarly to what commit 91c1f2b ("Map SSH2_FX_FAILURE to ENOTEMPTY for rmdir") did whereas |
…stems sshfs.rst: update the documentation.
3016689
to
9d36afa
Compare
What does this workaround mean? That the real fix is patching the OpenSSH SFTP server? What are the downsides to the sshfs workaround? (I just hit this issue on my system and wonder what the best way forward is.) |
Well, it means that sshfs will translate EPERM to EXDEV, so if the real problem is truly EPERM, you will get an incorrect error code. And yes, a better fix would be for the server to return EXDEV :-) |
On Mon, Aug 13, 2018 at 04:52:02PM -0700, Bjørn Forsman wrote:
What does this workaround mean? That the real fix is patching the OpenSSH SFTP
server? What are the downsides to the sshfs workaround? (I just hit this issue
on my system and wonder what the best way forward is.)
There is no SFTP standard that enables an SSH server to return the
equivalent of the EXDEV error code. The common error returned by the
server is translated to EPERM normally, which might or not correspond to
the real error on the server side; translating it to EXDEV makes the
client side program react differently, but once again the error might or
not correspond to the real error on the server side.
To improve things there are several ways:
1. Come up with a new SFTP standard that in a very long time will be
implemented in most SFTP servers.
2. Implement an SFTP extension in one server (e.g. in OpenSSH) that
allows to get a more precise error.
3. SFTP may make it possible to detect if there is a mountpoint between
the remote source and the remote destination; so in case of an error
only translate it to EXDEV if the remotes are on different mounts;
this last case would only lower the number of inadequate EXDEV
errors when the option "renamexdev" is on (to replace them by EPERM
errors that may also be inadequate).
|
Thanks for the info. I found this patch interesting: openssh/openssh-portable@f7fa706. Unless I'm reading it wrong, openssh can be built with (undocumented) -DEXDEV flag since 2008, doing "the right thing" (IMHO) all by itself. I realise that I don't even know what, in terms of syscalls, |
This is a fix that closes #100 (in the style of workaround as nothing better can be done it seems).
The change simply catches EPERM in sshfs_rename() and substitutes EXDEV.