Description of problem: Reading a file over sftp in dolphin corrupts it. More exactly: in the end it is nearly double as long and has repeating parts. The bug is in kio_sftp.so Version-Release number of selected component (if applicable): 4.14.3-2.fc20 How reproducible: Connect an Android smartphone using sftp and an sshd on the phone in dolphin. access a file larger than 61440 bytes, e.g. a jpeg photo Steps to Reproduce: 1. Install sshd on your android smartphone. Probably it also happens with other servers offering sftp 2. Connect in dolphin e.g. right mouse key on the left pane, select "Add Entry ..." 3. Enter sth. like sftp://<usename-on-smartphone>:<password-on-smartphone>@<your-smartphone-network-name>:<port>/ (ignore your personal security concerns regarding the password in the URL for a moment, later you can use RSA or other pubkey authentication or whatever) 4. Navigate to a JPEG image 5. open it with any picture viewer Actual results: The accessed file is corrupt Expected results: The accessed file is downloaded as is and can be used Additional info: It does not happen with Gnome's nautilus. The temporary file created from the download in /var/tmp/kdecache-<username>/krun/... is larger than the original. When examining it, one can find, that parts repeat inside. The problem has to do with the queued handling of read requests in kioslave/sftp/kio_sftp.cpp . In sftpProtocol::GetRequest::readChunks i see, that if not enough bytes have been read, the request is re-issued, what might not be the appropriate action. Particularly what i see happening: First 32768 bytes are read. 61440 had been requested. So the request is re-issued. Next 28672 bytes are read. Then 32768 are read, which start with the same stuff like the 28672 bytes read before. So something is quite badly wrong here. I haven't yet fully understood how to fix this. When i find it i'll post, but i don't have arbitrary time and i guess the maintainer is more familiar with the code. Thank you.
Thanks for the analysis. ideally, it would be best if you filed this upstream @ https://bugs.kde.org/enter_bug.cgi?product=kio&format=guided against component sftp
Note: I think the assumtion in sftpProtocol::GetRequest::readChunks, that it is an error, when sftp_async_read returns less bytes than requested, is not appropriate. Especially when reading asynchronously and e.g. over a not so fast connection (what is the case here), i'd consider it normal, that i have to issue several read requests
thanks for the upstream report, will continue tracking there.
Pulling in upstream fix...
kde-runtime-4.14.3-3.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/kde-runtime-4.14.3-3.fc21
kde-runtime-4.14.3-3.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/kde-runtime-4.14.3-3.fc20
Package kde-runtime-4.14.3-3.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing kde-runtime-4.14.3-3.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-0569/kde-runtime-4.14.3-3.fc21 then log in and leave karma (feedback).
kde-runtime-4.14.3-3.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
kde-runtime-4.14.3-3.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.