All of lore.kernel.org
 help / color / mirror / Atom feed
* lsetxattr/lgetxattr on ext4.
@ 2010-04-01  0:06 jvrao
  2010-04-01 21:54 ` Mingming Cao
  0 siblings, 1 reply; 4+ messages in thread
From: jvrao @ 2010-04-01  0:06 UTC (permalink / raw)
  To: linux-ext4

lsetxattr()/lgetxsttr() functions are not working on a ext4 symlink. 
But works fine on a regular file.

I tried the following program.. Not sure if I am missing something.
Any help will be appreciated.


--------- simple program -------------
[jvrao]# cat sxl.c
#include <stdio.h>
#include <sys/types.h>
#include <attr/xattr.h>

main()
{
	int ha=5;
	int ha_out=-1;
	int err;
	err = lsetxattr("./foo", "user.junk", &ha, sizeof(int),0);
	if (err == -1)
		perror("lsetxattr failed");
	lgetxattr("./foo", "user.junk", &ha_out, sizeof(int));
	if (err == -1)
		perror("lsetxattr failed");
	printf("file:./foo ha:%d  ha_out:%d\n", ha, ha_out);

	ha_out = -1;
	err = lsetxattr("./foo.sl", "user.junk", &ha, sizeof(int),0);
	if (err == -1)
		perror("lsetxattr failed");
	lgetxattr("./foo.sl", "user.junk", &ha_out, sizeof(int));
	if (err == -1)
		perror("lsetxattr failed");
	printf("file:./foo.sl  ha:%d  ha_out:%d\n", ha, ha_out);
}
------------------------

[jvrao]# ls -l foo*
-rw-r--r--. 1 root root 0 2010-03-31 16:49 foo
lrwxrwxrwx. 1 root root 3 2010-03-31 16:49 foo.sl -> foo

[jvrao]# ./sxl
file:./foo ha:5  ha_out:5
lsetxattr failed: Operation not permitted
lsetxattr failed: Operation not permitted
file:./foo.sl  ha:5  ha_out:-1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lsetxattr/lgetxattr on ext4.
  2010-04-01  0:06 lsetxattr/lgetxattr on ext4 jvrao
@ 2010-04-01 21:54 ` Mingming Cao
  2010-04-01 22:01   ` Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Mingming Cao @ 2010-04-01 21:54 UTC (permalink / raw)
  To: jvrao; +Cc: linux-ext4

On Wed, 2010-03-31 at 17:06 -0700, jvrao wrote:
> lsetxattr()/lgetxsttr() functions are not working on a ext4 symlink. 
> But works fine on a regular file.
> 
> I tried the following program.. Not sure if I am missing something.
> Any help will be appreciated.
> 
> 


I tried your test program on ext2/3/btrfs, it seems all broken. 
Not sure how this not being visible? Thought xattrs are heavily used by
default on some distros.


Mingming

> --------- simple program -------------
> [jvrao]# cat sxl.c
> #include <stdio.h>
> #include <sys/types.h>
> #include <attr/xattr.h>
> 
> main()
> {
> 	int ha=5;
> 	int ha_out=-1;
> 	int err;
> 	err = lsetxattr("./foo", "user.junk", &ha, sizeof(int),0);
> 	if (err == -1)
> 		perror("lsetxattr failed");
> 	lgetxattr("./foo", "user.junk", &ha_out, sizeof(int));
> 	if (err == -1)
> 		perror("lsetxattr failed");
> 	printf("file:./foo ha:%d  ha_out:%d\n", ha, ha_out);
> 
> 	ha_out = -1;
> 	err = lsetxattr("./foo.sl", "user.junk", &ha, sizeof(int),0);
> 	if (err == -1)
> 		perror("lsetxattr failed");
> 	lgetxattr("./foo.sl", "user.junk", &ha_out, sizeof(int));
> 	if (err == -1)
> 		perror("lsetxattr failed");
> 	printf("file:./foo.sl  ha:%d  ha_out:%d\n", ha, ha_out);
> }
> ------------------------
> 
> [jvrao]# ls -l foo*
> -rw-r--r--. 1 root root 0 2010-03-31 16:49 foo
> lrwxrwxrwx. 1 root root 3 2010-03-31 16:49 foo.sl -> foo
> 
> [jvrao]# ./sxl
> file:./foo ha:5  ha_out:5
> lsetxattr failed: Operation not permitted
> lsetxattr failed: Operation not permitted
> file:./foo.sl  ha:5  ha_out:-1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lsetxattr/lgetxattr on ext4.
  2010-04-01 21:54 ` Mingming Cao
@ 2010-04-01 22:01   ` Eric Sandeen
  2010-04-01 22:34     ` jvrao
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2010-04-01 22:01 UTC (permalink / raw)
  To: Mingming Cao; +Cc: jvrao, linux-ext4

Mingming Cao wrote:
> On Wed, 2010-03-31 at 17:06 -0700, jvrao wrote:
>> lsetxattr()/lgetxsttr() functions are not working on a ext4 symlink. 
>> But works fine on a regular file.
>>
>> I tried the following program.. Not sure if I am missing something.
>> Any help will be appreciated.
>>
>>
> 
> 
> I tried your test program on ext2/3/btrfs, it seems all broken. 
> Not sure how this not being visible? Thought xattrs are heavily used by
> default on some distros.

xfs as well FWIW.

however, I'm not sure setting user xattrs directly on symlinks is
a common operation...

-Eric


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lsetxattr/lgetxattr on ext4.
  2010-04-01 22:01   ` Eric Sandeen
@ 2010-04-01 22:34     ` jvrao
  0 siblings, 0 replies; 4+ messages in thread
From: jvrao @ 2010-04-01 22:34 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Mingming Cao, linux-ext4

Eric Sandeen wrote:
> Mingming Cao wrote:
>> On Wed, 2010-03-31 at 17:06 -0700, jvrao wrote:
>>> lsetxattr()/lgetxsttr() functions are not working on a ext4 symlink. 
>>> But works fine on a regular file.
>>>
>>> I tried the following program.. Not sure if I am missing something.
>>> Any help will be appreciated.
>>>
>>>
>>
>> I tried your test program on ext2/3/btrfs, it seems all broken. 
>> Not sure how this not being visible? Thought xattrs are heavily used by
>> default on some distros.
> 
> xfs as well FWIW.
> 
> however, I'm not sure setting user xattrs directly on symlinks is
> a common operation...

Looking at the  attr(5) says user xattrs are not allowed on symlinks and special files.
I guess it is working as designed. :)

- JV

> 
> -Eric
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-01 22:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-01  0:06 lsetxattr/lgetxattr on ext4 jvrao
2010-04-01 21:54 ` Mingming Cao
2010-04-01 22:01   ` Eric Sandeen
2010-04-01 22:34     ` jvrao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.