Bug 7990 - lsetxattr: value truncated
Summary: lsetxattr: value truncated
Status: VERIFIED FIXED
Alias: None
Product: Pseudo
Classification: Yocto Project Subprojects
Component: pseudo (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 1.9 M2
Assignee: Seebs
QA Contact: Daniel Istrate
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-07-13 08:44 UTC by Patrick Ohly
Modified: 2015-09-22 14:41 UTC (History)
4 users (show)

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


Attachments
don't truncate xattr values (1.59 KB, patch)
2015-07-13 09:57 UTC, Patrick Ohly
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]#