-
Notifications
You must be signed in to change notification settings - Fork 502
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
Read error on remote is reported as EOF #224
Comments
Thanks for the report! Do you know a way to reliably reproduce this problem (i.e., how to trigger a read error on the remote side)? I suspect that the problem is not with SSHFS, but with the SFTP protocol (which is not used by scp). In that cases there is unfortunately nothing that we can do on the SSHFS side to change this... |
It should be fairly easy if you can create a throwaway checksummed filesystem. Just create a small image file, format it with e.g. BTRFS, put some files onto it and write some junk onto the backing loop device. As long as you can still mount it (or simply don't unmount it in the first place), you should now get read errors when trying to read those files. |
Here's what I did to test this more thoroughly. On Remote:
On Local:
After connecting with |
Thanks for investigating! The next step would probably be to enable |
I can reproduce this. I attached a corrupted file system image that can be used for testing. You can mount it like so: gunzip errimg.gz
mkdir mnt
sudo mount errimg mnt It contains a single file This is what sshfs shows with debug enabled:
Below is the script that I used to create the attached file. It needs the program #!/usr/bin/bash
dd if=/dev/zero of=img bs=1M count=45
DEV=$(losetup --show --find img)
mkfs.btrfs $DEV
mkdir mnt
mount $DEV mnt
dd if=/dev/zero bs=1M count=16 > mnt/file
echo 'MAGICSTRING' >> mnt/file
umount mnt
losetup --detach $DEV
bbe --expression='s/MAGICSTRING/ERRORSTRING/' --output=errimg img
gzip --keep errimg |
This is what the transfer looks like if the file is not corrupted:
So apparently the problem is that if a READ gets a STATUS response, that STATUS is ignored. |
Thanks for digging into this! Would you be able to take a look at the code and maybe fix the issue? It seems you have narrowed down what's going wrong. (SSHFS is fully volunteer driven. This means new features and bugfixes are implemented only when someone has a personal interest in them and therefore also does the necessary work. ) |
When trying to sequentially read a file (i.e. copying it) and the remote host runs into a read error, sshfs / fuse instead reports end-of-file. The local side has no way of knowing that an error occured and will assume EOF was actually reached. This results in partial copies without any error message whatsoever. This is especially bad in conjunction with
mv
(across filesystem boundaries), as that will unlink the source file after apparently successfully copying it.scp
properly reports the I/O error. Both local and remote host are running OpenSSH 8.3p1 on Arch, local has sshfs 3.7.0.The text was updated successfully, but these errors were encountered: