D27871: sftp: fix seekPos + file resuming when part file is of size 11

Harald Sitter noreply at phabricator.kde.org
Thu Mar 5 14:56:20 GMT 2020


sitter created this revision.
sitter added reviewers: ngraham, feverfew.
Herald added projects: Dolphin, Frameworks.
Herald added subscribers: kfm-devel, kde-frameworks-devel.
sitter requested review of this revision.

REVISION SUMMARY
  previously seekPos would loop over offset==EAGAIN. the returned off_t of
  seek is not an error, but the offset or -1. this incorrect handling
  of the return value resulted in attempting to seek a file of the size 11
  to get stuck in an infinite loop as EAGAIN==11 and so the loop would
  always be true. any other file size would have been fine, so the impact
  of this is actually super small.
  
  also sync up the expectation and handling a bit more between copy and put
  scenarios.
  specifically we always seek to the size we (think) the part file has,
  instead of letting the libc determine the end. this is in part so
  we can simply do an offset==size comparison to check if the seek worked
  to the end we expected it to.
  
  the seekPos() helper was removed as it now serves no purpose over calling
  lseek directly.
  
  BUG: 417645
  FIXED-IN: 20.04

TEST PLAN
  - create file
  - `split -b 11` file to get a segment exactly EAGAIN size
  - copy first segment to some other dir as file.part
  - open sftp to other dir and copy file there
  - copy doesn't get stuck, the file.part is removed, and the resulting file is same as input
  - vice versa copy from sftp to local

REPOSITORY
  R320 KIO Extras

BRANCH
  sftp-seekpos

REVISION DETAIL
  https://phabricator.kde.org/D27871

AFFECTED FILES
  sftp/kio_sftp.cpp

To: sitter, ngraham, feverfew
Cc: 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20200305/554f2bcb/attachment.htm>


More information about the kfm-devel mailing list