Bug 201995 - *xattr() mentions obsolete <attr/xattr.h>
Summary: *xattr() mentions obsolete <attr/xattr.h>
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: documentation_man-pages@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-14 18:55 UTC by Enrico Scholz
Modified: 2018-12-22 06:01 UTC (History)
2 users (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Enrico Scholz 2018-12-14 18:55:04 UTC
The *xattr man pages (e.g. getxattr()) still mention <attr/xattr.h> which is not available anymore:

       ENOATTR
              ... is defined ... in <attr/xattr.h>.)

Unfortunately, there does not seem to exist a trivial fix:

- ENOATTR is not defined by any system header (at least in glibc-2.28)

- with attr-2.4.48, you can #include <attr/attributes.h>, but previous versions do not define ENOATTR there; e.g.

  #include <sys/xattr.h>
  #include <attr/attributes.h>

  works with attr-2.4.48, but not with attr-2.4.47

- best choice might be an

  #ifndef ENOATTR
  # define ENOATTR ENODATA
  #endif

  and hope that nobody implements errno numbers as enums...
Comment 1 Michael Kerrisk 2018-12-21 16:16:35 UTC
I think you must be looking at a quite ancient version of the manual pages. This problem was fixed with:

commit 4f72d935e5ee5fdd6e598cf1c1adff420e432217
Author: Michael Kerrisk <mtk.manpages@gmail.com>
Date:   Thu Feb 6 15:24:36 2014 +0100

    getxattr.2, listxattr.2, removexattr.2, setxattr.2: Correct header file is <sys/xattr.h> (not <xattr/xattr.h>)
    
    See https://bugzilla.kernel.org/show_bug.cgi?id=70141
    
    Reported-by: Fabrice Bauzac <libnoon@gmail.com>
    Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

I'll close this now. Please reopen if I missed something.
Comment 2 Enrico Scholz 2018-12-21 16:27:37 UTC
No, it is in recent man-pages too.  E.g. look at http://man7.org/linux/man-pages/man2/fgetxattr.2.html in the "ERRORS" section.
Comment 3 Michael Kerrisk 2018-12-21 19:44:30 UTC
(In reply to Enrico Scholz from comment #2)
> No, it is in recent man-pages too.  E.g. look at
> http://man7.org/linux/man-pages/man2/fgetxattr.2.html in the "ERRORS"
> section.

Okay -- sorry. I read through your bug report a little two quickly...
Comment 4 Andreas Gruenbacher 2018-12-21 20:52:20 UTC
The <attr/attributes.h> header is provided by libattr-devel or a similar package, but Enrico rightly said that this was only added in v2.4.48, released in 2015; in addition, it doesn't make much sense that a syscall implemented in glibc depends on a macro defined in libattr-devel.

So as Michael suggested in personal email, I would propose to just update the manual pages to say that the system calls return ENODATA; this has always been correct.
Comment 5 Michael Kerrisk 2018-12-22 06:01:48 UTC
THanks, Andreas. I've changed ENOATTR to ENODATA in the pages whow below.

diff --git a/man2/getxattr.2 b/man2/getxattr.2
index 03b3a40c6..58f2f728f 100644
--- a/man2/getxattr.2
+++ b/man2/getxattr.2
@@ -115,14 +115,14 @@ attribute cannot be retrieved.
 This can happen on filesystems that support
 very large attribute values such as NFSv4, for example.
 .TP
-.B ENOATTR
+.B ENODATA
 The named attribute does not exist, or the process has no access to
 this attribute.
-.RB ( ENOATTR
-is defined to be a synonym for
-.BR ENODATA
-in
-.IR <attr/xattr.h> .)
+.\" .RB ( ENOATTR
+.\" is defined to be a synonym for
+.\" .BR ENODATA
+.\" in
+.\" .IR <attr/xattr.h> .)
 .TP
 .B ENOTSUP
 Extended attributes are not supported by the filesystem, or are disabled.
diff --git a/man2/removexattr.2 b/man2/removexattr.2
index cac53d397..76af8e97d 100644
--- a/man2/removexattr.2
+++ b/man2/removexattr.2
@@ -82,13 +82,13 @@ On failure, \-1 is returned and
 is set appropriately.
 .SH ERRORS
 .TP
-.B ENOATTR
+.B ENODATA
 The named attribute does not exist.
-.RB ( ENOATTR
-is defined to be a synonym for
-.BR ENODATA
-in
-.IR <attr/xattr.h> .)
+.\" .RB ( ENOATTR
+.\" is defined to be a synonym for
+.\" .BR ENODATA
+.\" in
+.\" .IR <attr/xattr.h> .)
 .B ENOTSUP
 Extended attributes are not supported by the filesystem, or are disabled.
diff --git a/man2/setxattr.2 b/man2/setxattr.2
index 34fae7df2..3b301d5b2 100644
--- a/man2/setxattr.2
+++ b/man2/setxattr.2
@@ -121,14 +121,14 @@ there is insufficient space remaining to store the extended attribute.
 .B XATTR_CREATE
 was specified, and the attribute exists already.
 .TP
-.B ENOATTR
+.B ENODATA
 .B XATTR_REPLACE
 was specified, and the attribute does not exist.
-.RB ( ENOATTR
-is defined to be a synonym for
-.BR ENODATA
-in
-.IR <attr/xattr.h> .)
+.\" .RB ( ENOATTR
+.\" is defined to be a synonym for
+.\" .BR ENODATA
+.\" in
+.\" .IR <attr/xattr.h> .)
 .TP
 .B ENOSPC
 There is insufficient space remaining to store the extended attribute.

I'll close this bug now, but feel free, Enrico, to reopen if your concerns have not been addressed.

Thanks,

Michael

Note You need to log in before you can comment on or make changes to this bug.