Fix silently ignoring STATUS response after READ
This attempts to fix #224, but is incomplete yet. Open questions:
-
[ ] Does
resneed to be set in the immediately following else-if-branch and in the last else-branch as well? I guess not, because the case whenchunk->sio.errorequalsMY_EOFis explicitly guarded a couple lines above. -
[ ] Do I need such a
MY_EOFguard for the line that I added? -
[ ] When encountering an I/O error, SFTP reports a
SSH_FX_FAILUREwhich, by the functionsftp_error_to_errno, is mapped to anEPERM. This leads to us getting an “Operation not permitted” over sshfs instead of an I/O error. CanEPERMbe replaced byEIO?
My addition of the word else is purely for stylistic reasons and does not change the control flow.
Thanks for the patch! I'm afraid I do not know the answers to your questions. The best I can do is to study the code carefully myself and try to figure this out, so this review might take a while. Any help is appreciated.
Once thing that comes to mind is that we probably need to check how real permissions errors are reported - we wouldn't want to get EIO if permissions are incorrect.
Is this ready for review? I understand from the original message that there are still open questions, but it's not clear to me if you're still working on them (or other issues) or if you're waiting for someone to review this.
This is my first pull request where I’m actually fixing something and I don’t know how confident I need to be to release it. As far as I remember, this fixes the bug. But I can’t estimate all the implications that this code change has.
So I’d say yes, this is ready for review. The open questions are questions that a reviewer would need to answer to check if the code is correct.
First step is to make sure the tests in the CI still pass, currently they are failing. That means either your code has a bug or the test has a bug - but in both cases it needs to be fixed.