arrowd added a comment.

  In D17816#677446 <https://phabricator.kde.org/D17816#677446>, @kdudka wrote:
  
  > I was wondering why copying files in Krusader or Dolphin from a 
vfat-formatted memory card stopped working for me after update.  After copying 
the first file, the transfer stopped progressing and the process ended up 
consuming 100% CPU forever.  Later I discovered that the cause of the breakage 
was this patch: If fgetxattr() fails with ENOTSUP, the code loops indefinitely 
calling fgetxattr().
  >
  > The following hotfix made copying of files in Krusader work again for me:
  >  ...
  >
  > However, the code might need bigger changes to cover all the cases.  I do 
not fully understand the (IMO over-complicated) loops around flistxattr() and 
fgetxattr().  Note that the fact that one of them uses `while (true) { ... }` 
whereas the other one uses `do { ... } while (true)` does not improve code 
readability either.
  
  
  I think, the correct fix is something like
  
    diff --git a/src/ioslaves/file/file_unix.cpp 
b/src/ioslaves/file/file_unix.cpp
    index 74767123..4bc87c57 100644
    --- a/src/ioslaves/file/file_unix.cpp
    +++ b/src/ioslaves/file/file_unix.cpp
    @@ -614,8 +614,8 @@ bool FileProtocol::copyXattrs(const int src_fd, const 
int dest_fd)
                     valuelen = 0;
                     continue;
                 }
    -            // happens when attr value is an empty string
    -            if (valuelen == 0) {
    +            // valuelen=0 happens when attr value is an empty string
    +            if (valuelen == 0 || valuelen == -1) {
                     break;
                 }
             } while (true);
  
  Can you check if this works for you too?

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

To: arrowd, dfaure, chinmoyr, bruns, #frameworks, tmarshall, usta, cochise
Cc: kdudka, usta, scheirle, tmarshall, arrowd, cfeck, bruns, phidrho, dhaumann, 
funkybomber, abika, pino, davidedmundson, ngraham, atha.kane, spoorun, 
nicolasfella, kde-frameworks-devel, LeGast00n, cblack, michaelh

Reply via email to