[SFTP] Read from write-only file not returning error
stefbon at gmail.com
Tue Aug 8 17:55:33 AEST 2017
2017-08-06 11:29 GMT+02:00 Nikolaus Rath <Nikolaus at rath.org>:
> As far as I can tell, when sending a SSH_FXP_OPEN request with
> SSH_FXF_WRITE (i.e., opening the file write only), and then following up
> with a SSH_FXP_READ, the server responds with a SSH_FXP_STATUS
> indicating that all data has been read.
I'm doing the same using my fuse sftp client as described in the sshfs issue 72.
The second command
echo bar >> test.txt
with writeback cache enabled causes also a read command send while the
flags send to the sftp server
only allow write. The value of pflags indicating how the file has to
opened is 6 = 4 | 2 = write and append.
This value is used by the sftp server. So far so good.
The read command (caused by writeback cache) returns a status reply 2
This error code is not correct but it's possible that this is the
"best guess". The number of error codes in the rfc
(which is used by the openssh sftp-server) is very limited.
What is the value sshfs receives? In the status codes used by the
sftp-server there is no "all data is read".
I will test this behaviour with another sftp server.
The read command is not there anymore when not using writeback cache.
More information about the openssh-unix-dev