[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [kio] [Bug 342391] New: kio_sftp.so corrupts files when reading
From:       Albert Flügel <albert.fluegel () freenet ! de>
Date:       2015-01-01 15:55:04
Message-ID: bug-342391-17878 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=342391

            Bug ID: 342391
           Summary: kio_sftp.so corrupts files when reading
           Product: kio
           Version: 4.14.1
          Platform: Fedora RPMs
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: sftp
          Assignee: asn@cryptomilk.org
          Reporter: albert.fluegel@freenet.de

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: 4.14.3-2.fc20
(4.14.3 is not offered in the menu above)

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.

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. I'll try to examine this in more detail or patch,
but i can't promise, that i'll get it done in the next time.


Reproducible: Always

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. For more details please see in the Details
section


Expected Results:  
The accessed file is downloaded as is and can be used


It does not happen with Gnome's nautilus (who is calling ssh as subprogram and
does not use libssl).
I switched on debug mode like explained in
https://techbase.kde.org/Development/Tutorials/Debugging/Debugging_IOSlaves/Debugging_kio_sftp#SFTP_Logging.
 The compressed log can be downloaded here:
http://www.muc.de/~af/kio_sftp.log.xz

-- 
You are receiving this mail because:
You are watching all bug changes.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic