-
Notifications
You must be signed in to change notification settings - Fork 22
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
Can't send to SFTP destinations that don't support FSETSTAT #1189
Comments
I think we need to wrap all the calls with try/except and emit a warning instead of having the transfer fail: try: we could also have a credentials setting "noFSETSTAT" as a flag on sftp to not even try... It's a little project. |
should we have timeout(0) implement a disabling of timeouts as a side-quest on this one? |
I vote yes for this, it should be an easy change to have alarm_set to only set the alarm when timeout > 0 |
So I have a branch that is running in testing... and I implemented a the warning thing, and the timeout disabling thing. now with just those changes, the sender will work, but it will spit out a warning for every file sent "warning truncate failed"... So I implemented a nofsetattr as a keyword in the credentials file, and so when you declare your sftp server credentials you add that keyword, and you will no longer get any warnings. I'm now having second thoughts... should it be a credentials keyword or an option in the sr3_options... if people use ~/.ssh/config to store their sftp auth setup (as they should) then there is no need for an entry in the credentials.config... except this new flag... ugh... that's why I'm wondering if a normal keyword option is the better way to go. |
another option might be something like: set sarracenia.transfer.sftp.Sftp.nofsetstat on declare it as an option in the sftp transfer protocol... hmm.. |
I changed it to an option in the config file. Seems more straight-forward. |
I prefer the option in the config file, I think it's easier to find and avoids creating credentials.conf entries that we wouldn't need otherwise. I like |
need a new branch for a second try. |
Sending to SFTP destinations that don't support FSETSTAT causes a failure:
Looking at the Paramiko code revealed that FSETSTAT is used for
chmod
,chown
,utime
andtruncate
.This happens even with
timeCopy
andpermCopy
set to False, so we shouldn't be calling chmod, chown or utime.We do call truncate in 2 places:
readlocal_write
of the Transfer class:sarracenia/sarracenia/transfer/__init__.py
Line 401 in f7563bc
sarracenia/sarracenia/transfer/sftp.py
Line 486 in f7563bc
In the SFTP code, there's already logic to determine if a file already exists on the destination, so we could possibly do something with that to not call truncate in the case where the file doesn't already exist.
We could additionally add a try/except around the truncate call(s), but need to be careful to make sure we're not ignoring failures to truncate in cases where truncation really was needed (when a new file overwrites a larger old file).
The workaround is to use binary acceleration for all file transfers to these destinations.
The text was updated successfully, but these errors were encountered: