D17816: Support for xattrs on kio copy/move

Stefan BrĂ¼ns noreply at phabricator.kde.org
Tue Mar 2 12:48:35 GMT 2021


bruns added a comment.


  In D17816#677449 <https://phabricator.kde.org/D17816#677449>, @kdudka wrote:
  
  > Even after applying the proposed patch, the code still looks problematic to me.  I would prefer to have it explained first.  When fgetxattr(..., 0) returns -1/ERANGE, what is the point of calling fgetxattr(..., 0) again?  It is still going to busy-loop indefinitely in this case, doesn't it?  How many times do we actually need to call fgetxattr() on a single file descriptor?  Twice?  Then unbounded loop is not the best construction to begin with.
  
  
  Ever heard of a TOCTOU race?
  
  Quoting from man 2 getxattr:
  
  > If size is specified as zero, these calls return the current size of the named extended attribute (and leave value unchanged).  This can be used to determine the size of the buffer that should be supplied in a subsequent call.   (But,  bear  in  mind  that  there is a possibility that the attribute value may change between the two calls, so that it is still necessary to check the return status from the second call.)

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20210302/6196ee26/attachment.htm>


More information about the Kde-frameworks-devel mailing list