-
Notifications
You must be signed in to change notification settings - Fork 4
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
Incorrect behavior about AsyncSeek
of TokioCompatFile
#80
Comments
Note that File::start_seek does not support SeekFrom::End, since I'm not sure how to implement it in a race-free manner |
Also, in
offset can be larger than the self.buffer.len(), this is a UB according to AsyncBufRead interface. |
However, our AsyncBufRead impl is also wrong openssh-sftp-client/src/file/tokio_compat_file.rs Lines 383 to 391 in ec57895
It should panic if amt is more than self.buffer.len() |
What I suggest you to do is to advance the buffer and increase offset manually in
|
I think so. I'll complete it tomorrow. |
It will also be great if you can fix ::consume |
Sometimes
AsyncSeek
toTokioCompatFile
will set the offset to the wrong place. This error occurs in apache/opendal#2263 https://github.com/apache/incubator-opendal/actions/runs/4976970726/jobs/8905529556I guess the problem is about
openssh-sftp-client/src/file/tokio_compat_file.rs
Line 354 in ec57895
openssh-sftp-client/src/file/tokio_compat_file.rs
Lines 383 to 391 in ec57895
When the offset amount is larger than
buffer.len()
, it will only offset to the end of buffer.I haven't found the code which can reproduce stably. I will try to fix it these days.
The text was updated successfully, but these errors were encountered: