diff options
author | Kamil Dudka <kdudka@redhat.com> | 2009-01-23 12:17:53 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-01-29 13:26:07 +0100 |
commit | 0889381cbfdbb4895e6b8693d14c0f5c77bc85bc (patch) | |
tree | 1c93168a0d0c7e5ff72df37c4b34607b0eb3aaea /m4 | |
parent | 1bdf77ad523fca6f3781f5614706246f20394a62 (diff) | |
download | coreutils-0889381cbfdbb4895e6b8693d14c0f5c77bc85bc.tar.xz |
cp/mv: add xattr support
This patch was originally written by Andreas Grünbacher, nowadays
available at
http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff
* bootstrap.conf: Add gnulib module verror.
* po/POTFILES.in: Add lib/verror.c.
* m4/xattr.m4: Check for libattr availability, new configure option
--disable-xattr.
* m4/prereq.m4: Require gl_FUNC_XATTR.
* src/Makefile.am: Link cp, mv and ginstall with libattr.
* src/copy.h: Add preserve_xattr and require_preserve_xattr to
cp_options.
* src/copy.c (copy_attr_error): New function to handle errors during
xattr copying.
(copy_attr_quote): New function to quote file name in error messages
printed by libattr.
(copy_attr_free): Empty function requested by libattr to free quoted
string.
(copy_attr_by_fd): New fd-oriented function to copy xattr.
(copy_attr_by_name): New name-oriented function to copy xattr.
(copy_reg, copy_internal): Call copy_extended_attributes function.
* src/cp.c (usage): Mention new --preserve=xattr option.
(decode_preserve_arg): Handle new --preserve=xattr option.
* src/mv.c: Always attempt to preserve xattr.
* src/install.c: Never attempt to preserve xattr.
* tests/misc/xattr: New test for xattr support in cp, mv and install.
* tests/Makefile.am: Add the new test to list.
* doc/coreutils.texi: Mention xattr support, new --preserve=xattr
option.
* NEWS: Mention the change.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/prereq.m4 | 1 | ||||
-rw-r--r-- | m4/xattr.m4 | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/m4/prereq.m4 b/m4/prereq.m4 index e65682fea..536070efe 100644 --- a/m4/prereq.m4 +++ b/m4/prereq.m4 @@ -38,6 +38,7 @@ AC_DEFUN([gl_PREREQ], # handles that; see ../bootstrap.conf. AC_REQUIRE([gl_EUIDACCESS_STAT]) AC_REQUIRE([gl_FD_REOPEN]) + AC_REQUIRE([gl_FUNC_XATTR]) AC_REQUIRE([gl_FUNC_XFTS]) AC_REQUIRE([gl_MEMXFRM]) AC_REQUIRE([gl_STRINTCMP]) diff --git a/m4/xattr.m4 b/m4/xattr.m4 new file mode 100644 index 000000000..c5bf12988 --- /dev/null +++ b/m4/xattr.m4 @@ -0,0 +1,36 @@ +# xattr.m4 - check for Extended Attributes (Linux) + +# Copyright (C) 2003, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Originally written by Andreas Gruenbacher. +# http://www.suse.de/~agruen/coreutils/5.91/coreutils-xattr.diff + +AC_DEFUN([gl_FUNC_XATTR], +[ + AC_ARG_ENABLE([xattr], + AC_HELP_STRING([--disable-xattr], + [do not support extended attributes]), + [use_xattr=$enableval], [use_xattr=yes]) + + if test "$use_xattr" = "yes"; then + AC_CHECK_HEADERS([attr/error_context.h attr/libattr.h]) + if test $ac_cv_header_attr_libattr_h = yes \ + && test $ac_cv_header_attr_error_context_h = yes; then + use_xattr=1 + else + use_xattr=0 + fi + AC_DEFINE_UNQUOTED([USE_XATTR], [$use_xattr], + [Define if you want extended attribute support.]) + xattr_saved_LIBS=$LIBS + AC_SEARCH_LIBS([attr_copy_file], [attr], + [test "$ac_cv_search_attr_copy_file" = "none required" || + LIB_XATTR=$ac_cv_search_attr_copy_file]) + AC_CHECK_FUNCS([attr_copy_file]) + LIBS=$xattr_saved_LIBS + AC_SUBST([LIB_XATTR]) + fi +]) |