Bug 7990

Summary: lsetxattr: value truncated
Product: [Yocto Project Subprojects] Pseudo Reporter: Patrick Ohly <patrick.ohly>
Component: pseudoAssignee: Seebs <seebs>
Status: VERIFIED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: normal    
Priority: Medium+ CC: alexandru.c.georgescu, ross.burton, yp.pseudo.watcher, yp.watcher
Version: unspecified   
Target Milestone: 1.9 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
don't truncate xattr values none

Description Patrick Ohly 2015-07-13 08:44:41 UTC
Certain xattr values get truncated. Here's an example, using setfattr and getfattr from Debian's "attr" package. Run under pseudo:

# touch foobar
# setfattr -n security.ima -v 0x032f foobar
# getfattr -d -m . -e hex foobar
# file: foobar
security.ima=0x03

Note that the last byte of the value is missing. It's also suspicious that 2f is hex for a slash, and that there is special handling for trailing slashes in pseudo_client_op().
Comment 1 Patrick Ohly 2015-07-13 09:57:19 UTC
Created attachment 2587 [details]
don't truncate xattr values

It was the pseudo server which removed the trailing slash from the xattr value. Here's a patch against 1.6.4 (as in Poky Fido) which avoids that for those operations where "oldpath" is not really a path.
Comment 2 Seebs 2015-07-15 21:59:27 UTC
D'oh. That's a really beautiful bug, and one I'd completely failed to think of. Nice catch! Yes, that needs to get fixed.
Comment 3 Ross Burton 2015-07-23 20:41:36 UTC
Fixed in pseudo 1.6.7, merged in oe-core 0295947a2ccc66037f9c20f06b4b69a781a046bd.
Comment 4 Daniel Istrate 2015-09-22 14:41:05 UTC
Verified on master: 7b86c771c80d0759c2ca0e57c46c4c966f89c49e

Steps to verify:
1. bitbake m4 -c devshell
2. When the terminal pops up attempt the commands from the Description:

[root@fedora-ws m4-1.4.17]# touch foobar
[root@fedora-ws m4-1.4.17]# setfattr -n security.ima -v 0x032f foobar
[root@fedora-ws m4-1.4.17]# getfattr -d -m . -e hex foobar
# file: foobar
security.ima=0x032f

[root@fedora-ws m4-1.4.17]#