Created attachment 2212 [details] Patch for sftp-server to add lsetstat extension At the moment sftp is not able to set timestamps on symlinks. In order to make this possible lsetstat needs to be implemented. Attached patch makes this addition. Some background info. I want to run dirvish over sshfs in order to make daily remote snapshot-backups. Currently rsync (which is used by dirvish) reports an error when updating the timestamp of a symlink. This in turn makes dirvish abort the backup. In cooperation with Miklos Szeredi, the author of sshfs, I have created attached patch. He has created the functionality in sshfs to make use of this lsetstat extenstion in sftp. I've used this patch for 5 months now and it behaves perfectly. Dirvish creates complete backups every day now. I have also created a patch for the sftp client-side to implement a "touch [-h]" command. This command makes it possible to update the utime of a symlink. It was mostly used to test above functionality, but will be handy in more cases. I will add this patch here too.
Created attachment 2213 [details] Patch to sftp to add touch [-h] command
Can someone please take a look to this patch? I have been using it in my system for over a year now. I'd love to have it included. Or at least reviewed;-)
Hopefully someone can take this patch into openssh? I am running this happily for a long time now. But recompiling with every upgrade is a hassle..
I'm afraid I don't have much to add, other than to say that the OP is not the only person with this issue, I know at least one person who has been lamenting the lack of this feature for some time.... I guess not everyone is prepared to create an account to add their support!
I just want to +1 this. Also, I want to point out that this seem like the root cause of an issue with extracting tar archives when using sshfs. In short, if a symlink gets extracted before its target, when tar attempts to set the time for that symlink, it fails because the target of the symlink doesn't (yet) exist, causing tar itself to report an error. This results for instance in steam failing to install its runtime when running from a home folder mounted over sshfs. I haven't looked at the patch proposed here, so I can't vouch for it, but lsetstat seem to be a very much needed feature, especially in a world where sshfs is becoming a popular way to mount remote folders.
Created attachment 3219 [details] sftp-server lsetstat extension, sftp client chmod/chgrp/chown -h flag This implements the lsetstat@openssh.com extension in the server, with a few more Attrib fields supported than the previous patches here. On the client side, it adds a -h to the chown, chmod and chgrp command to give them no-dereference semantics.
Comment on attachment 3219 [details] sftp-server lsetstat extension, sftp client chmod/chgrp/chown -h flag >- sshbuf_reset(msg); these look like unrelated cleanup and should probably be a separate commit. other than that, ok dtucker
This has been committed and will be in openssh-8.0. I haven't committed the "touch" command for sftp, but if you have a good use case for it then I can consider it.
Thanks for including this lsetstat extention patch in V8.0! I have no personal usecase for the touch command. I added it as it is a logical addition, based on the added hardlink functionality. It would be a shame to leave it out, as it is very low-impact.
closing resolved bugs as of 8.6p1 release