Bug 10349

Summary: renameat() loses extended attributes
Product: [Yocto Project Subprojects] Pseudo Reporter: Anton Gerasimov <anton>
Component: pseudoAssignee: Joshua Lock <joshuagloe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: anton, joshuagloe, seebs, yp.pseudo.watcher, yp.watcher
Version: master   
Target Milestone: 2.2 M4   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Utility to reproduce the bug none

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