Bug 10349 - renameat() loses extended attributes
Summary: renameat() loses extended attributes
Status: RESOLVED FIXED
Alias: None
Product: Pseudo
Classification: Yocto Project Subprojects
Component: pseudo (show other bugs)
Version: master
Hardware: x86 x86_64
: Medium+ normal
Target Milestone: 2.2 M4
Assignee: Joshua Lock
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-09-29 17:16 UTC by Anton Gerasimov
Modified: 2016-10-06 15:46 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Utility to reproduce the bug (852 bytes, application/gzip)
2016-09-29 17:16 UTC, Anton Gerasimov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Gerasimov 2016-09-29 17:16:46 UTC
Created attachment 3445 [details]
Utility to reproduce the bug

For some reason after renameat() extended attributes are no more there. Strangely enough it is not the case with plain rename(). The attached program gives no error in normal environment and outputs "fgetattr: no data available" in pseudo.

try as root: make; make test
Comment 1 Seebs 2016-09-30 13:53:55 UTC
Huh. That's mildly surprising, renameat() shouldn't need to do anything about extended attributes unless it's moving across filesystems, since xattrs are stored by dev/inode. I'll try to get a look.
Comment 2 Anton Gerasimov 2016-09-30 15:01:45 UTC
Thank you!
I was debugging communication from the client side (calls to pseudo_client_request) and the only difference between rename and renameat that I've noticed is that rename (healthy one) OP_STATs the old file and doesn't OP_LINK it, while renameat (th buggy one) goes directly to OP_LINK without OP_STAT.
One can actually see the difference in ports/unix/guts/rename(at).c - lines 37-39 in rename.c that are missing in renameat.c. Could you please tell me, what is the reason for this difference? I couldn't figure it out yet.
Comment 3 Anton Gerasimov 2016-09-30 15:50:10 UTC
I've sent a patch with possible solution. I've tested it shortly on my utility, but I don't know pseudo good enough to be sure that it doesn't break anything. Please take a look.

https://lists.yoctoproject.org/pipermail/poky/2016-September/010725.html
Comment 4 Seebs 2016-10-06 15:41:48 UTC
The patch is correct and is now merged in upstream.
Comment 5 Joshua Lock 2016-10-06 15:46:31 UTC
Submitted for inclusion in the upcoming release:
http://lists.openembedded.org/pipermail/openembedded-core/2016-October/127359.html