-
Notifications
You must be signed in to change notification settings - Fork 380
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
request server: add support for SSH_FXP_FSETSTAT #373
Conversation
This change will fix file editing from sshfs, we need this patch pkg/sftp#373 for pkg/sftp to support this feature
Hm… interesting. Is this something really critical that we should address before releasing 1.12? File corrupt does seems like a showstopper. |
It depends on what the client do. We will have corrupted files if the client use Probably we should also add an optional |
Hi, I improved the patch. After a Truncate the offset for the next read is now updated as expected. I was wrong about |
we need to add a case for this packet inside the packet worker otherwise it will be handled in hasHandle case and it will become a "Put" request. Client side if a Truncate request is called on the open file we should send a FSETSTAT packet, the request is on the handle, and not a SETSTAT packet that should be used for paths and not for handle.
improved Fsetstat test case
Regarding CI I updated travis to go 1.15 however I would switch to GitHub actions in future, Actions are better integrated with GitHub and we cannot merge a pull request without noticing that it breaks build, do you have objections? Do you think we can break compatibility after 1.12? I would like to do the following backward incompatible changes:
|
If you want to do the work to switch us over to GitHub actions over travis, 🤷♀️ I wouldn’t complain 😆 I’m honestly not all that impressed with As for reworking the whole RequestServer mechanics, I’m kind of 😬 about. The only reason to have RequestServer is that it is a helpful abstraction layer hiding facets of SFTP from the implementing service. If the only thing it does is thinly wrap the whole of the SFTP protocol, then it stops being all that useful. If suddenly now one has to implement all the features to get any functionality at all? 👎 More ideally, we want to give a quick access to 80% of the functionality without excessive overhead. If someone needs that 20% we don’t support, then they can deal with a more primitive layer directly (that perhaps we could also build out and expose as a subpackage). |
Ok I'll submit a pull request
Ok, we will discuss better about this in future, I'll try to send a pull request with some basic linters
Request-Server is the only choice if you want to interact with non local fs (in SFTPGo I support S3 and GCS and I could add Azure blog storage in future). I think we can add optional interfaces for the missing features instead of a new subpackage. I need the generic openfile method to fix the reported file corruption issue in SFTPGo. What do you think about an optional interface? If it is implemented it will be called instead of "Get" and "Put", we can do the same for "Lstat" if an optional interface is implemented we call it otherwise we call "Stat" as now. I don't know the history of this project, based on your answer I understand that the Request-Server is not intented to replace the server implementation. OK. |
Yeah, this is a good idea. We should probably work on converging towards something similar to the Exactly like you said, this would be nice since a “simplest” implementation of The project wasn’t probably as well defined of scope when it started unfortunately. And I think most of the API popped in without a multi-draft proposal process, so some choices were made that were maybe not ideal. (I know What with the (probable) future roll out of |
Ok, I'll try to send a new patch for this (later this week or the next one). Thank you for your reviews :-)
I quicky readed the proposal some weeks ago, I'll read it better and in future I'll try to help with v2 |
I don’t think we need a new patch right now. And most of this patch is already pretty necessary to avoid calling a We can get this done, and hopefully checked in before EOW, then cut a release for Friday? I hope? And then we can start looking for the future on how we want a v2 to look. |
Hi, I'm not fully understanding your answer. We have two issues here:
I can work on this today, I'll will be unavailable from tomorrow until Friday
|
|
ok
sounds good |
we need to add a case for this packet inside the packet worker otherwise
it will be handled in hasHandle case and it will become a "Put" request.
Client side if a Truncate request is called on the open file we should
send a FSETSTAT packet, the request is on the handle, and not a SETSTAT
packet that should be used for paths and not for handle.
We should probably do the same for Chmod/Chtimes/Stat too.
This patch fix file corruption using
sshfs
. Simply create a text file using sshfs and then delete some lines, the file will be corrupted.See the truncate issue reported here for more details