D17816: Support for xattrs on kio copy/move

Stefan BrĂ¼ns noreply at phabricator.kde.org
Tue Mar 5 15:25:59 GMT 2019


bruns added a comment.


  Does this work correctly when the source is a symlink? - getxattr vs lgetxattr.

INLINE COMMENTS

> copyxattrjob.cpp:134
> +#endif
> +        if (valuelen == -1) {
> +            q->setErrorText(QLatin1String("libc failed to extract a xattr value from file"));

if errno=ERANGE, the list has grown after you called listxattr(file, nullptr, 0). This is completetely valid, see man 2 listxattr:

> But, bear in mind that there is  a possibility  that  the  set  of extended attributes may change between the two calls, so that it is still necessary to check the return status from the second call.

Same applies for getxattr.

Also, you can cut the number of syscalls by half by using an opportunistic buffer size. Also saves you from allocating a buffer for each attribute value. As said, you have to check for "ERANGE" anyway.

REPOSITORY
  R241 KIO

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

To: cochise, dfaure
Cc: cfeck, bruns, phidrho, dhaumann, funkybomber, abika, pino, davidedmundson, ngraham, atha.kane, spoorun, nicolasfella, kde-frameworks-devel, michaelh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190305/4b181b0b/attachment.html>


More information about the Kde-frameworks-devel mailing list