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

REVISION SUMMARY
  Compiling this module produces a number of warnings all referring to the same 
source:
  
  kio-extras/smb/kio_smb_internal.h: In member function 'void 
SMBUrl::setFileName(const QString&)':
  kio-extras/smb/kio_smb_internal.h:96: warning: ignoring return value of 'QUrl 
QUrl::adjusted(QUrl::FormattingOptions) const', declared with attribute 
nodiscard
  
  The problem code is trying to make a URL for a partial file being 
uploaded/copied.  However, because QUrl::adjusted() does not modify the URL in 
place, the copy operation works but does not use the intended partial file 
name.  For example, if the destination file is "smb://server/dir/foobar.ext", 
the partial file name used will be 
"smb://server/dir/foobar.extfoobar.ext.part".  The complete file will 
eventually be saved under the correct name, but the name will be wrong if the 
transfer is aborted and the user wants to find the partial file.
  
  There is also the possibility of an error if the file name is long and the 
destination server has a length limit, because it effectively doubles in length.
  
  The change fixes the problem and simplifies the code by simply appending 
".part" to the supplied URL path directly.  No other part of the ioslave uses 
SMBUrl::setFileName() or SMBUrl::partUrl(), so this does not raise any 
compatibility problems.

TEST PLAN
  Built kio_smb with this change.  Observed no compiler warning messages, 
correct copying to and from SMB, and use of the correct partial file name.

REPOSITORY
  R320 KIO Extras

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

AFFECTED FILES
  smb/kio_smb_internal.cpp
  smb/kio_smb_internal.h

To: marten, #plasma, #frameworks
Cc: kde-frameworks-devel, kfm-devel, alexde, feverfew, michaelh, spoorun, 
navarromorales, firef, ngraham, andrebarros, bruns, emmanuelp, mikesomov

Reply via email to