Greetings,
While updating the CLFS book and adding enhancements, Chris mentioned that ACL
doesn't need ATTR.
I tracked down some information about using sys/xattr.h
http://lists.gnu.org/archive/html/acl-devel/2014-05/msg00001.html
I've modified the patch for use with the acl-2.2.52 source and have attached to
this email.
Before:
nm /lib/libacl.so.1.1.0 | grep attr
0000000000004580 T __acl_from_xattr
0000000000004500 T __acl_to_xattr
U fgetxattr@@ATTR_1.0
U fsetxattr@@ATTR_1.0
U getxattr@@ATTR_1.0
U lgetxattr@@ATTR_1.0
U removexattr@@ATTR_1.0
U setxattr@@ATTR_1.0
After:
nm /lib/libacl.so.1.1.0 | grep attr
0000000000004770 T __acl_from_xattr
00000000000046f0 T __acl_to_xattr
U fgetxattr@@GLIBC_2.3
U fsetxattr@@GLIBC_2.3
U getxattr@@GLIBC_2.3
U lgetxattr@@GLIBC_2.3
U removexattr@@GLIBC_2.3
U setxattr@@GLIBC_2.3
For the ATTR package, the tools attr, getfattr, setfattr are only required to
be installed along with their man pages. There is no need to install the Attr
libraries or headers. The utilities will link to the Glibc for xattr.
I've attached a patch for Attr.
I'm only putting this to the list for possible addition to the books.
Sincerely,
William Harrington
--
William Harrington <[email protected]>
diff -Naur acl-2.2.52.orig/configure acl-2.2.52/configure
--- acl-2.2.52.orig/configure 2013-05-19 05:51:16.000000000 +0000
+++ acl-2.2.52/configure 2015-09-26 19:45:27.877630802 +0000
@@ -12416,9 +12416,9 @@
fi
- for ac_header in attr/xattr.h
+ for ac_header in sys/xattr.h
do :
- ac_fn_c_check_header_mongrel "$LINENO" "attr/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default"
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default"
if test "x$ac_cv_header_attr_xattr_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ATTR_XATTR_H 1
@@ -12430,33 +12430,12 @@
if test "$ac_cv_header_attr_xattr_h" != "yes"; then
echo
- echo 'FATAL ERROR: attr/xattr.h does not exist.'
+ echo 'FATAL ERROR: sys/xattr.h does not exist.'
echo 'Install the extended attributes (attr) development package.'
echo 'Alternatively, run "make install-dev" from the attr source.'
exit 1
fi
- for ac_header in attr/error_context.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "attr/error_context.h" "ac_cv_header_attr_error_context_h" "$ac_includes_default"
-if test "x$ac_cv_header_attr_error_context_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTR_ERROR_CONTEXT_H 1
-_ACEOF
-
-fi
-
-done
-
- if test "$ac_cv_header_attr_error_context_h" != "yes"; then
- echo
- echo 'FATAL ERROR: attr/error_context.h does not exist.'
- echo 'Install the extended attributes (attr) development package.'
- echo 'Alternatively, run "make install-dev" from the attr source.'
- exit 1
- fi
-
-
enable_lib64="$enable_lib64"
libdirsuffix=""
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
@@ -12477,64 +12456,6 @@
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getxattr in -lattr" >&5
-$as_echo_n "checking for getxattr in -lattr... " >&6; }
-if ${ac_cv_lib_attr_getxattr+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lattr $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getxattr ();
-int
-main ()
-{
-return getxattr ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_attr_getxattr=yes
-else
- ac_cv_lib_attr_getxattr=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_attr_getxattr" >&5
-$as_echo "$ac_cv_lib_attr_getxattr" >&6; }
-if test "x$ac_cv_lib_attr_getxattr" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBATTR 1
-_ACEOF
-
- LIBS="-lattr $LIBS"
-
-else
-
- echo
- echo 'FATAL ERROR: could not find a valid Extended Attributes library.'
- echo 'Install the extended attributes (attr) development package.'
- echo 'Alternatively, run "make install-lib" from the attr source.'
- exit 1
-
-fi
-
- libattr="-lattr"
- test -f `pwd`/../attr/libattr/libattr.la && \
- libattr="`pwd`/../attr/libattr/libattr.la"
-
-
have_zipped_manpages=false
for d in ${prefix}/share/man ${prefix}/man ; do
if test -f $d/man1/man.1.gz
diff -Naur acl-2.2.52.orig/libacl/Makefile acl-2.2.52/libacl/Makefile
--- acl-2.2.52.orig/libacl/Makefile 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/Makefile 2015-09-26 19:45:43.961630549 +0000
@@ -22,7 +22,7 @@
include $(TOPDIR)/include/builddefs
LTLIBRARY = libacl.la
-LTLIBS = -lattr $(LIBMISC)
+LTLIBS = $(LIBMISC)
LTDEPENDENCIES = $(LIBMISC)
LT_CURRENT = 2
LT_REVISION = 0
diff -Naur acl-2.2.52.orig/libacl/__acl_extended_file.c acl-2.2.52/libacl/__acl_extended_file.c
--- acl-2.2.52.orig/libacl/__acl_extended_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/__acl_extended_file.c 2015-09-26 19:44:03.461632131 +0000
@@ -19,8 +19,13 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "byteorder.h"
diff -Naur acl-2.2.52.orig/libacl/acl_delete_def_file.c acl-2.2.52/libacl/acl_delete_def_file.c
--- acl-2.2.52.orig/libacl/acl_delete_def_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_delete_def_file.c 2015-09-26 19:44:03.461632131 +0000
@@ -19,12 +19,15 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "byteorder.h"
#include "acl_ea.h"
-#include "config.h"
-
+#include "libobj.h"
/* 23.4.8 */
int
diff -Naur acl-2.2.52.orig/libacl/acl_extended_fd.c acl-2.2.52/libacl/acl_extended_fd.c
--- acl-2.2.52.orig/libacl/acl_extended_fd.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_extended_fd.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,8 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "byteorder.h"
diff -Naur acl-2.2.52.orig/libacl/acl_extended_file.c acl-2.2.52/libacl/acl_extended_file.c
--- acl-2.2.52.orig/libacl/acl_extended_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_extended_file.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,8 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "__acl_extended_file.h"
diff -Naur acl-2.2.52.orig/libacl/acl_extended_file_nofollow.c acl-2.2.52/libacl/acl_extended_file_nofollow.c
--- acl-2.2.52.orig/libacl/acl_extended_file_nofollow.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_extended_file_nofollow.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,8 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "__acl_extended_file.h"
diff -Naur acl-2.2.52.orig/libacl/acl_get_fd.c acl-2.2.52/libacl/acl_get_fd.c
--- acl-2.2.52.orig/libacl/acl_get_fd.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_get_fd.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,11 +19,15 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include <acl/libacl.h>
#include "libacl.h"
#include "__acl_from_xattr.h"
diff -Naur acl-2.2.52.orig/libacl/acl_get_file.c acl-2.2.52/libacl/acl_get_file.c
--- acl-2.2.52.orig/libacl/acl_get_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_get_file.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,11 +19,15 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include <acl/libacl.h>
#include "libacl.h"
#include "__acl_from_xattr.h"
diff -Naur acl-2.2.52.orig/libacl/acl_set_fd.c acl-2.2.52/libacl/acl_set_fd.c
--- acl-2.2.52.orig/libacl/acl_set_fd.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_set_fd.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,8 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "__acl_to_xattr.h"
diff -Naur acl-2.2.52.orig/libacl/acl_set_file.c acl-2.2.52/libacl/acl_set_file.c
--- acl-2.2.52.orig/libacl/acl_set_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/acl_set_file.c 2015-09-26 19:44:03.465632131 +0000
@@ -19,10 +19,14 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "libacl.h"
#include "__acl_to_xattr.h"
diff -Naur acl-2.2.52.orig/libacl/error_context.h acl-2.2.52/libacl/error_context.h
--- acl-2.2.52.orig/libacl/error_context.h 1970-01-01 00:00:00.000000000 +0000
+++ acl-2.2.52/libacl/error_context.h 2015-09-26 19:44:03.465632131 +0000
@@ -0,0 +1,53 @@
+/*
+ Copyright (C) 2009 Andreas Gruenbacher <address@hidden>
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __ERROR_CONTEXT_T
+#define __ERROR_CONTEXT_T
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct error_context {
+ /* Process an error message */
+ void (*error) (struct error_context *, const char *, ...);
+
+ /* Quote a file name for including in an error message */
+ const char *(*quote) (struct error_context *, const char *);
+
+ /* Free a quoted name */
+ void (*quote_free) (struct error_context *, const char *);
+};
+
+#ifdef ERROR_CONTEXT_MACROS
+# define error(ctx, args...) do { \
+ if ((ctx) && (ctx)->error) \
+ (ctx)->error((ctx), args); \
+ } while(0)
+# define quote(ctx, name) \
+ ( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) )
+# define quote_free(ctx, name) do { \
+ if ((ctx) && (ctx)->quote_free) \
+ (ctx)->quote_free((ctx), (name)); \
+ } while(0)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ERROR_CONTEXT_T */
diff -Naur acl-2.2.52.orig/libacl/libobj.h acl-2.2.52/libacl/libobj.h
--- acl-2.2.52.orig/libacl/libobj.h 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/libobj.h 2015-09-26 19:44:03.465632131 +0000
@@ -19,8 +19,11 @@
#define __LIBOBJ_H
#include <stdlib.h>
+#include <errno.h>
-#include "config.h"
+#ifndef ENOATTR
+# define ENOATTR ENODATA /* No such attribute */
+#endif
/* Mark library internal functions as hidden */
#if defined(HAVE_VISIBILITY_ATTRIBUTE)
diff -Naur acl-2.2.52.orig/libacl/perm_copy_fd.c acl-2.2.52/libacl/perm_copy_fd.c
--- acl-2.2.52.orig/libacl/perm_copy_fd.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/perm_copy_fd.c 2015-09-26 19:44:03.465632131 +0000
@@ -17,9 +17,10 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#if defined (HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
#if defined(HAVE_LIBACL_LIBACL_H)
# include "libacl.h"
#endif
@@ -39,11 +40,7 @@
#endif
#define ERROR_CONTEXT_MACROS
-#ifdef HAVE_ATTR_ERROR_CONTEXT_H
-#include <attr/error_context.h>
-#else
#include "error_context.h"
-#endif
#if !defined(ENOTSUP)
# define ENOTSUP (-1)
diff -Naur acl-2.2.52.orig/libacl/perm_copy_file.c acl-2.2.52/libacl/perm_copy_file.c
--- acl-2.2.52.orig/libacl/perm_copy_file.c 2013-04-30 15:20:43.000000000 +0000
+++ acl-2.2.52/libacl/perm_copy_file.c 2015-09-26 19:44:03.465632131 +0000
@@ -17,9 +17,10 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#if defined (HAVE_CONFIG_H)
+#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+
#if defined(HAVE_LIBACL_LIBACL_H)
# include "libacl.h"
#endif
@@ -39,11 +40,7 @@
#endif
#define ERROR_CONTEXT_MACROS
-#ifdef HAVE_ATTR_ERROR_CONTEXT_H
-#include <attr/error_context.h>
-#else
#include "error_context.h"
-#endif
#if !defined(ENOTSUP)
# define ENOTSUP (-1)
diff -Naur attr-2.4.47.orig/attr/Makefile attr-2.4.47/attr/Makefile
--- attr-2.4.47.orig/attr/Makefile 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/attr/Makefile 2015-09-27 00:16:14.889375076 +0000
@@ -20,9 +20,7 @@
include $(TOPDIR)/include/builddefs
LTCOMMAND = attr
-CFILES = attr.c
-LLDLIBS = $(LIBATTR)
-LTDEPENDENCIES = $(LIBATTR)
+CFILES = attr.c ../libattr/libattr.o
default: $(LTCOMMAND)
diff -Naur attr-2.4.47.orig/getfattr/Makefile attr-2.4.47/getfattr/Makefile
--- attr-2.4.47.orig/getfattr/Makefile 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/getfattr/Makefile 2015-09-27 00:15:54.321375400 +0000
@@ -22,8 +22,8 @@
LTCOMMAND = getfattr
CFILES = getfattr.c
-LLDLIBS = $(LIBMISC) $(LIBATTR)
-LTDEPENDENCIES = $(LIBMISC) $(LIBATTR)
+LLDLIBS = $(LIBMISC)
+LTDEPENDENCIES = $(LIBMISC)
default: $(LTCOMMAND)
diff -Naur attr-2.4.47.orig/getfattr/getfattr.c attr-2.4.47/getfattr/getfattr.c
--- attr-2.4.47.orig/getfattr/getfattr.c 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/getfattr/getfattr.c 2015-09-27 00:15:54.321375400 +0000
@@ -29,7 +29,7 @@
#include <locale.h>
#include <libgen.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "config.h"
#include "walk_tree.h"
#include "misc.h"
diff -Naur attr-2.4.47.orig/libattr/attr_copy_fd.c attr-2.4.47/libattr/attr_copy_fd.c
--- attr-2.4.47.orig/libattr/attr_copy_fd.c 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/libattr/attr_copy_fd.c 2015-09-27 00:15:54.321375400 +0000
@@ -31,7 +31,7 @@
#endif
#if defined(HAVE_ATTR_XATTR_H)
-# include <attr/xattr.h>
+# include <sys/xattr.h>
#endif
#if defined(HAVE_ATTR_LIBATTR_H)
diff -Naur attr-2.4.47.orig/libattr/attr_copy_file.c attr-2.4.47/libattr/attr_copy_file.c
--- attr-2.4.47.orig/libattr/attr_copy_file.c 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/libattr/attr_copy_file.c 2015-09-27 00:15:54.321375400 +0000
@@ -31,7 +31,7 @@
#endif
#if defined(HAVE_ATTR_XATTR_H)
-# include <attr/xattr.h>
+# include <sys/xattr.h>
#endif
#if defined(HAVE_ATTR_LIBATTR_H)
diff -Naur attr-2.4.47.orig/libattr/libattr.c attr-2.4.47/libattr/libattr.c
--- attr-2.4.47.orig/libattr/libattr.c 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/libattr/libattr.c 2015-09-27 00:15:54.321375400 +0000
@@ -17,12 +17,15 @@
*/
#include <errno.h>
+#ifndef ENOATTR
+# define ENOATTR ENODATA /* No such attribute */
+#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include <attr/attributes.h>
#undef MAXNAMELEN
diff -Naur attr-2.4.47.orig/man/Makefile attr-2.4.47/man/Makefile
--- attr-2.4.47.orig/man/Makefile 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/man/Makefile 2015-09-27 00:15:54.321375400 +0000
@@ -19,7 +19,7 @@
TOPDIR = ..
include $(TOPDIR)/include/builddefs
-SUBDIRS = man1 man2 man3 man5
+SUBDIRS = man1
default : $(SUBDIRS)
diff -Naur attr-2.4.47.orig/setfattr/Makefile attr-2.4.47/setfattr/Makefile
--- attr-2.4.47.orig/setfattr/Makefile 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/setfattr/Makefile 2015-09-27 00:15:54.321375400 +0000
@@ -22,8 +22,8 @@
LTCOMMAND = setfattr
CFILES = setfattr.c
-LLDLIBS = $(LIBMISC) $(LIBATTR)
-LTDEPENDENCIES = $(LIBMISC) $(LIBATTR)
+LLDLIBS = $(LIBMISC)
+LTDEPENDENCIES = $(LIBMISC)
default: $(LTCOMMAND)
diff -Naur attr-2.4.47.orig/setfattr/setfattr.c attr-2.4.47/setfattr/setfattr.c
--- attr-2.4.47.orig/setfattr/setfattr.c 2013-05-19 04:53:54.000000000 +0000
+++ attr-2.4.47/setfattr/setfattr.c 2015-09-27 00:15:54.321375400 +0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -28,7 +29,7 @@
#include <ctype.h>
#include <libgen.h>
-#include <attr/xattr.h>
+#include <sys/xattr.h>
#include "config.h"
#include "misc.h"
--
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page