Hiya,

I've just built coreutils 8.4 on a machine with libattr installed, and
found that tests/cp/cp-mv-enotsup-xattr was failing because cp was
incorrectly giving the "cp is built without xattr support" error
message. The problem appears to be that the configure script defines
USE_XATTR to "yes" if attr support is enabled, but copy.c and cp.c use
"#if USE_XATTR"/"#if !USE_XATTR" to test it. The attached patch changes
these to use #ifdef/#ifndef, which makes the testsuite pass for me.

Thanks,

-- 
Adam Sampson <a...@offog.org>                         <http://offog.org/>
Test for USE_XATTR correctly: the configure script defines it to "yes" if
libattr is available, or doesn't define it at all if it's not.

diff -x config.log -x config.status -ru tmp/coreutils-8.4/src/copy.c 
work/coreutils-8.4/src/copy.c
--- tmp/coreutils-8.4/src/copy.c        2010-01-03 17:06:20.000000000 +0000
+++ work/coreutils-8.4/src/copy.c       2010-01-16 11:26:45.914419566 +0000
@@ -54,7 +54,7 @@
 #include "areadlink.h"
 #include "yesno.h"
 
-#if USE_XATTR
+#ifdef USE_XATTR
 # include <attr/error_context.h>
 # include <attr/libattr.h>
 # include <stdarg.h>
@@ -174,7 +174,7 @@
   return err == ENOTSUP || err == ENODATA;
 }
 
-#if USE_XATTR
+#ifdef USE_XATTR
 static void
 copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
                  char const *fmt, ...)
diff -x config.log -x config.status -ru tmp/coreutils-8.4/src/cp.c 
work/coreutils-8.4/src/cp.c
--- tmp/coreutils-8.4/src/cp.c  2010-01-04 15:46:06.000000000 +0000
+++ work/coreutils-8.4/src/cp.c 2010-01-16 11:26:51.992419509 +0000
@@ -1141,7 +1141,7 @@
                  "without an SELinux-enabled kernel"));
     }
 
-#if !USE_XATTR
+#ifndef USE_XATTR
   if (x.require_preserve_xattr)
     error (EXIT_FAILURE, 0, _("cannot preserve extended attributes, cp is "
                               "built without xattr support"));

Reply via email to