bugattr - Bugs: bug #37027, attr_multi will never perform a...

 
 

bug #37027: attr_multi will never perform a remove operation with ATTR_OP_REMOVE

Submitted by:  None
Submitted on:  Sat 04 Aug 2012 02:47:54 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 04 Aug 2012 02:47:54 PM UTC, original submission:

I've been trying to remove attributes by calling attr_multi, but according to strace the syscall getxattr is being called instead of removexattr.

Looking at the relevant files in package version 2.4.46 we have in include/attributes.h:

/*

  • Valid values of am_opcode.

*/
#define ATTR_OP_GET 1 /* return the indicated attr's value */
#define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */
#define ATTR_OP_REMOVE 3 /* remove the indicated attr */

and in libattr/libattr.c:

static int
attr_single(const char path, attr_multiop_t op, int flags)
{
int r = -1;

errno = -EINVAL;
flags |= op->am_flags;
if (op->am_opcode & ATTR_OP_GET)
r = attr_get(path, op->am_attrname, op->am_attrvalue,
&op->am_length, flags);
else if (op->am_opcode & ATTR_OP_SET)
r = attr_set(path, op->am_attrname, op->am_attrvalue,
op->am_length, flags);
else if (op->am_opcode & ATTR_OP_REMOVE)
r = attr_remove(path, op->am_attrname, flags);
return r;
}

since ATTR_OP_GET & ATTR_OP_REMOVE == 1, the dispatching code above will never call the attr_remove() function. The code needs to either
- change the order of comparisons
- switch to comparing with == instead of bitbanging
- redefining ATTR_OP_REMOVE to 4 instead of 3.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

No Changes Have Been Made to This Item

Back to the top


Powered by Savane 3.1-cleanup