* Re: What should listxattr() return if there are no xattrs?
2010-12-20 13:26 What should listxattr() return if there are no xattrs? Theodore Ts'o
@ 2010-12-21 4:27 ` Aneesh Kumar K. V
2010-12-22 4:28 ` Jeremy Allison
2013-01-18 22:58 ` Michael Kerrisk (man-pages)
2 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K. V @ 2010-12-21 4:27 UTC (permalink / raw)
To: Theodore Ts'o, linux-fsdevel, a.gruenbacher, Wang Sheng-Hui,
Michael Kerrisk
On Mon, 20 Dec 2010 08:26:53 -0500, "Theodore Ts'o" <tytso@mit.edu> wrote:
>
> Wang Sheng-Hui has sent some patches that change listxattr for the extN
> file systems to return ENODATA when an inode has no extended attributes
> (instead of zero).
>
> I've noted that neither btrfs nor XFS do this, and would have rejected
> the patches on that basis. However, I'll note the man page for the
> listxattr(2) syscall is ambiguous:
>
> On success, a positive number is returned indicating the size of the
> extended attribute name list. On failure, -1 is returned and errno is
> set appropriately.
>
> It states that on success a _positive_ number is returned. I've looked
> and this wordining is in SGI's man page as well. I suspect the man page
> should be corrected to sate that "non-negative" number is returned?
I agree that man page needs update. Note that getfattr code does
length = do_listxattr(path, NULL, 0);
if (length < 0) {
fprintf(stderr, "%s: %s: %s\n", progname, xquote(path, "\n\r"),
strerror_ea(errno));
had_errors++;
return 1;
} else if (length == 0)
return 0;
-aneesh
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: What should listxattr() return if there are no xattrs?
2010-12-20 13:26 What should listxattr() return if there are no xattrs? Theodore Ts'o
2010-12-21 4:27 ` Aneesh Kumar K. V
@ 2010-12-22 4:28 ` Jeremy Allison
2013-01-18 22:58 ` Michael Kerrisk (man-pages)
2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Allison @ 2010-12-22 4:28 UTC (permalink / raw)
To: Theodore Ts'o
Cc: linux-fsdevel, a.gruenbacher, Wang Sheng-Hui, Michael Kerrisk
On Mon, Dec 20, 2010 at 08:26:53AM -0500, Theodore Ts'o wrote:
>
> Wang Sheng-Hui has sent some patches that change listxattr for the extN
> file systems to return ENODATA when an inode has no extended attributes
> (instead of zero).
>
> I've noted that neither btrfs nor XFS do this, and would have rejected
> the patches on that basis. However, I'll note the man page for the
> listxattr(2) syscall is ambiguous:
>
> On success, a positive number is returned indicating the size of the
> extended attribute name list. On failure, -1 is returned and errno is
> set appropriately.
>
> It states that on success a _positive_ number is returned. I've looked
> and this wordining is in SGI's man page as well. I suspect the man page
> should be corrected to sate that "non-negative" number is returned?
Samba calls listxattr() when deciding what EA's are present on
a file. Right now examining our code I think we'd survive a
return of -1/ENODATA on an absense of EA's, but it's a risky
change to make for existing applications.
Keeping consistency with btrfs and XFS would seem to be a
better idea (IMHO).
Jeremy.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: What should listxattr() return if there are no xattrs?
2010-12-20 13:26 What should listxattr() return if there are no xattrs? Theodore Ts'o
2010-12-21 4:27 ` Aneesh Kumar K. V
2010-12-22 4:28 ` Jeremy Allison
@ 2013-01-18 22:58 ` Michael Kerrisk (man-pages)
2 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2013-01-18 22:58 UTC (permalink / raw)
To: Theodore Ts'o
Cc: linux-fsdevel, a.gruenbacher, Wang Sheng-Hui, Michael Kerrisk
(Following up long after the fact...)
Thanks for CCing me Ted.
On Mon, Dec 20, 2010 at 2:26 PM, Theodore Ts'o <tytso@mit.edu> wrote:
>
> Wang Sheng-Hui has sent some patches that change listxattr for the extN
> file systems to return ENODATA when an inode has no extended attributes
> (instead of zero).
>
> I've noted that neither btrfs nor XFS do this, and would have rejected
> the patches on that basis. However, I'll note the man page for the
> listxattr(2) syscall is ambiguous:
>
> On success, a positive number is returned indicating the size of the
> extended attribute name list. On failure, -1 is returned and errno is
> set appropriately.
>
> It states that on success a _positive_ number is returned. I've looked
> and this wordining is in SGI's man page as well. I suspect the man page
> should be corrected to sate that "non-negative" number is returned?
Thanks. Fixed now, to say "nonnegative".
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
^ permalink raw reply [flat|nested] 4+ messages in thread