coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH libattr] build: unbreak attr_copy_fd() and attr_copy_file().


From: Nick Alcock
Subject: [PATCH libattr] build: unbreak attr_copy_fd() and attr_copy_file().
Date: Fri, 03 Oct 2014 13:54:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Mike's build-system-revamping commit 9ce21bd of January this year
accidentally dropped a crucial -include of "libattr.h". This silently
undefined the HAVE_F*ATTR macros, causing attr_copy_{fd,file}.c to think
that xattrs are not supported and to compile the functions in those
files into a 'return 0;' stub.

The code in these files uses the NLS _() macro, which was recently moved
into misc.h, which can only sensibly be included by things outside
libattr. So migrate the NLS macros into a new nls.h at the same time,
and include it from misc.h.

With these fixes in place, xattrs can be copied again.
---
 include/Makemodule.am    |  1 +
 include/misc.h           | 10 +---------
 include/nls.h            |  9 +++++++++
 libattr/Makemodule.am    |  1 +
 libattr/attr_copy_fd.c   |  1 +
 libattr/attr_copy_file.c |  1 +
 6 files changed, 14 insertions(+), 9 deletions(-)
 create mode 100644 include/nls.h

I'm not subscribed to acl-devel: hope this gets through.

This was spotted by the coreutils misc/xattr.sh test, which it might be
a good idea to run whenever you change libattr... :/

An equally effective alternative might be to drop the fairly pointless
libattr/libattr.h header and all the references to macros from it: but
this seems less invasive for now.

diff --git a/include/Makemodule.am b/include/Makemodule.am
index c43e2e4..e2017c5 100644
--- a/include/Makemodule.am
+++ b/include/Makemodule.am
@@ -6,4 +6,5 @@ pkginclude_HEADERS += \
 
 noinst_HEADERS += \
        include/misc.h \
+       include/nls.h \
        include/walk_tree.h
diff --git a/include/misc.h b/include/misc.h
index 3bab7de..8b8ec48 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -22,12 +22,4 @@ extern char *unquote(char *str);
 
 extern char *next_line(FILE *file);
 
-#ifdef ENABLE_NLS
-# include <libintl.h>
-# define _(x)                  gettext(x)
-#else
-# define _(x)                  (x)
-# define textdomain(d)         do { } while (0)
-# define bindtextdomain(d,dir) do { } while (0)
-#endif
-#include <locale.h>
+#include "nls.h"
diff --git a/include/nls.h b/include/nls.h
new file mode 100644
index 0000000..06f84bb
--- /dev/null
+++ b/include/nls.h
@@ -0,0 +1,9 @@
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(x)                   gettext(x)
+#else
+# define _(x)                   (x)
+# define textdomain(d)          do { } while (0)
+# define bindtextdomain(d,dir)  do { } while (0)
+#endif
+#include <locale.h>
diff --git a/libattr/Makemodule.am b/libattr/Makemodule.am
index 7e06e8e..5c888f0 100644
--- a/libattr/Makemodule.am
+++ b/libattr/Makemodule.am
@@ -17,6 +17,7 @@ libattr_la_SOURCES = \
        libattr/libattr.c \
        libattr/libattr.h \
        libattr/syscalls.c
+libattr_la_CFLAGS = -include libattr/libattr.h
 libattr_la_LDFLAGS = \
        -Wl,--version-script,$(top_srcdir)/exports \
        -version-info $(LTVERSION)
diff --git a/libattr/attr_copy_fd.c b/libattr/attr_copy_fd.c
index 14b7368..a21e8c2 100644
--- a/libattr/attr_copy_fd.c
+++ b/libattr/attr_copy_fd.c
@@ -40,6 +40,7 @@
 
 #define ERROR_CONTEXT_MACROS
 #include "error_context.h"
+#include "nls.h"
 
 #if !defined(ENOTSUP)
 # define ENOTSUP (-1)
diff --git a/libattr/attr_copy_file.c b/libattr/attr_copy_file.c
index 2efc224..9132433 100644
--- a/libattr/attr_copy_file.c
+++ b/libattr/attr_copy_file.c
@@ -40,6 +40,7 @@
 
 #define ERROR_CONTEXT_MACROS
 #include "error_context.h"
+#include "nls.h"
 
 #if !defined(ENOTSUP)
 # define ENOTSUP (-1)
-- 
2.1.0.182.g1aa0b9a.dirty




reply via email to

[Prev in Thread] Current Thread [Next in Thread]