Skip to content
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

Issue1189 SFTP FSETATTTR fix + timeout 0 support #1190

Closed
wants to merge 4 commits into from

Conversation

petersilva
Copy link
Contributor

close #1189

These are changes that deal with sftp servers.

  • wrap truncate/chmod/utime calls in sftp in try/excepts so that the transfers are not considered "failed" if one of those operations fails.
  • report a warning about the call failing instead.
  • add an nofsetstat option to the sr3_options configs, so that when we know that those operations won't work, don't even generate the warning message.

passes flow tests, but No tested with a server that restricts the permissions.

@iMacadan perhaps you can test this in sending to such a client.

Copy link

github-actions bot commented Aug 26, 2024

Test Results

247 tests   245 ✅  1m 34s ⏱️
  1 suites    1 💤
  1 files      1 ❌

For more details on these failures, see this check.

Results for commit 7fb6e28.

♻️ This comment has been updated with latest results.

The default value is listed in the man page is zero, which does
not match the source code (300) so changed that.

Also previous patch enabled use of 0 to disable timeouts, so
documented that behaviour.
@petersilva petersilva changed the title Issue1189 Issue1189 SFTP FSETATTTR fix + timeout 0 support Aug 27, 2024
Copy link
Member

@reidsunderland reidsunderland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by the change to alarm_cancel?

The change adds if time <= 0: return which changes the code from cancelling the alarm to doing nothing? And if a time > 0 is passed in, it would cancel the previous alarm but set a new one that will cause a signal to be sent after time seconds.

signal.alarm(time)
If time is non-zero, this function requests that a SIGALRM signal be sent to the process in time seconds. Any previously scheduled alarm is canceled (only one alarm can be scheduled at any time). The returned value is then the number of seconds before any previously set alarm was to have been delivered. If time is zero, no alarm is scheduled, and any scheduled alarm is canceled. If the return value is zero, no alarm is currently scheduled.

https://docs.python.org/3/library/signal.html#signal.alarm

@petersilva
Copy link
Contributor Author

The change is symmetric. If you cancel a non-existent alarm... that's an error. so when I changed the thing setting the alarm to... not do that... the cancel has to match...
I think... that was what I was thinking...

I don't know why one would want to cancel an alarm that we didn't set... how do we know?
so yeah... setting it to sero disables setting and clearing timeouts....

@petersilva petersilva marked this pull request as ready for review September 1, 2024 02:05
@petersilva
Copy link
Contributor Author

This branch will never be merged. Kept here as a place holder, reminder for a future branch.

  • drop the alarm clearing with arg. is already addressed by try/finally logic already merged.
  • need to extract the nofsetattr option stuff from this, and build a new PR with just that in it.

@petersilva petersilva closed this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't send to SFTP destinations that don't support FSETSTAT
2 participants