Bug 9324

Summary: pseudo: cannot remove xattr
Product: [Yocto Project Subprojects] Pseudo Reporter: Patrick Ohly <patrick.ohly>
Component: pseudoAssignee: Joshua Lock <joshuagloe>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: seebs, yp.pseudo.watcher, yp.watcher
Version: unspecified   
Target Milestone: 2.1 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Patrick Ohly 2016-03-22 15:42:42 UTC
"setfattr -x" does not work correctly under pseudo:

# touch foobar
# setfattr -n security.ima -v foo foobar 
# setfattr -x security.ima foobar
# getfattr -d -m . foobar 
# file: foobar
security.ima="foo"

Excepted result is no output from getfattr.
Comment 1 Seebs 2016-03-22 19:38:12 UTC
d'oh. There's a list of operations for which paths are extracted from the client request, and REMOVE_XATTR isn't in that list.

This still has the issues from 9317 to sort, but this part's trivial.
Comment 2 Patrick Ohly 2016-03-23 07:15:10 UTC
(In reply to comment #1)
> d'oh. There's a list of operations for which paths are extracted from the
> client request, and REMOVE_XATTR isn't in that list.
> 
> This still has the issues from 9317 to sort, but this part's trivial.

Fixing this issue here without addressing 9317 would be worthwhile already. We have a workaround for 9317 (avoid hardlinks), but not this one here.
Comment 3 Seebs 2016-03-23 19:50:36 UTC
Okay, so, it's a trivial one-line fix, but it's currently in my tree on top of an overhaul of the startup code. I think it might make sense to just add a patch for this to the oe-core tree until I get that startup code reviewed and vetted.

The actual patch, which really is this simple:

diff --git a/pseudo.c b/pseudo.c
index 2b60fd4..67ebb6a 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -484,6 +484,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char
                case OP_GET_XATTR:
                case OP_LIST_XATTR:
                case OP_REPLACE_XATTR:
+               case OP_REMOVE_XATTR:
                case OP_SET_XATTR:
                        /* In a rename there are two paths, null separated in ms
                        initial_len = strlen(msg->path);

(... and yes, I'm aware that I put it in the wrong place, it should be one line higher.)
Comment 4 Joshua Lock 2016-03-24 16:00:18 UTC
I've submitted a change to OE-Core to backport the fix from master of the pseudo git tree.

I tested with Patrick's example and in comment #1 and the result is no output from getfattr.

http://lists.openembedded.org/pipermail/openembedded-core/2016-March/119484.html