<table><tr><td style="">sitter created this revision.<br />sitter added reviewers: ngraham, feverfew.<br />Herald added projects: Dolphin, Frameworks.<br />Herald added subscribers: kfm-devel, kde-frameworks-devel.<br />sitter requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D27871">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>previously seekPos would loop over offset==EAGAIN. the returned off_t of<br />
seek is not an error, but the offset or -1. this incorrect handling<br />
of the return value resulted in attempting to seek a file of the size 11<br />
to get stuck in an infinite loop as EAGAIN==11 and so the loop would<br />
always be true. any other file size would have been fine, so the impact<br />
of this is actually super small.</p>

<p>also sync up the expectation and handling a bit more between copy and put<br />
scenarios.<br />
specifically we always seek to the size we (think) the part file has,<br />
instead of letting the libc determine the end. this is in part so<br />
we can simply do an offset==size comparison to check if the seek worked<br />
to the end we expected it to.</p>

<p>the seekPos() helper was removed as it now serves no purpose over calling<br />
lseek directly.</p>

<p>BUG: 417645<br />
FIXED-IN: 20.04</p></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">create file</li>
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">split -b 11</tt> file to get a segment exactly EAGAIN size</li>
<li class="remarkup-list-item">copy first segment to some other dir as file.part</li>
<li class="remarkup-list-item">open sftp to other dir and copy file there</li>
<li class="remarkup-list-item">copy doesn't get stuck, the file.part is removed, and the resulting file is same as input</li>
<li class="remarkup-list-item">vice versa copy from sftp to local</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R320 KIO Extras</div></div></div><br /><div><strong>BRANCH</strong><div><div>sftp-seekpos</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27871">https://phabricator.kde.org/D27871</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>sftp/kio_sftp.cpp</div></div></div><br /><div><strong>To: </strong>sitter, ngraham, feverfew<br /><strong>Cc: </strong>kde-frameworks-devel, kfm-devel, pberestov, iasensio, fprice, LeGast00n, cblack, MrPepe, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov<br /></div>