On Tuesday 16 of June 2015 20:24:50 Sergey Poznyakoff wrote:
> Charles Diza <chd...@gmail.com> ha escrit:
> 
> > I reported a long time ago that this patch works and that tar 1.28 will
> > again build properly on OSX when it's applied.  But looking in the git
> > repo, I don't seem to see that this patch has been merged.  Am I missing
> > something?
> 
> Not at all.  You are right, it has not been applied.  I'll see to it.

Hi Sergey, I rebased the patch against HEAD (Paul fixed the
--without-xattrs later [1]) and fixed the spelling to make the change more
clear, fix is attached.  Also attaching some gitignore fixes.

[1] http://lists.gnu.org/archive/html/bug-tar/2015-01/msg00004.html

Pavel
>From ef41c414d43f632689e6ad9d2c30ee233f35592d Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <prais...@redhat.com>
Date: Wed, 17 Jun 2015 14:32:35 +0200
Subject: [PATCH 1/2] .gitignore: more ignores

* doc/.gitignore: Add rmt.8 copied from paxutils.
* tests/.gitignore: Ignore built ttyemu.
---
 doc/.gitignore   | 1 +
 tests/.gitignore | 1 +
 2 files changed, 2 insertions(+)

diff --git a/doc/.gitignore b/doc/.gitignore
index 5bcd27d..226ba67 100644
--- a/doc/.gitignore
+++ b/doc/.gitignore
@@ -2,6 +2,7 @@ genfile.texi
 header.texi
 manual
 parse-datetime.texi
+rmt.8
 stamp-vti
 tar.aux
 tar.cp
diff --git a/tests/.gitignore b/tests/.gitignore
index c5382d0..9e9c2a0 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -8,3 +8,4 @@ argcv.c
 argcv.h
 genfile.c
 genfile
+ttyemu
-- 
2.1.0

>From 7ca6af1aa16e6a682bd5ce77a83ab4fb4c16fee7 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <prais...@redhat.com>
Date: Wed, 17 Jun 2015 15:37:12 +0200
Subject: [PATCH 2/2] xattrs: better ./configure check for xattr calls

Be careful to define HAVE_XATTRS when not all needed xattr-related
functions are properly defined either in libc or libattr.

Reported firstly by Dominyk Tiller:
http://lists.gnu.org/archive/html/bug-tar/2014-08/msg00001.html

* acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): De-duplicate a bit.
Don't use AC_CHECK_FUNCS macro with "list" of xattrs functions
because the 'action-if-found' there is evaluated for *any*
available function from the list -- and thus this previously
defined HAVE_XATTRS even though not all handlers were available.
Use rather AC_SEARCH_LIBS for each function separately.  This
change allowed us to remove AC_CHECK_LIB call (used previously
just to enhance $LIBS variable to satisfy following
AC_CHECK_FUNCS macro).
Remove also redundant AM_CONDITIONAL because TAR_LIB_ATTR
conditional was used just to to complement LIBS with '-lattr',
which was redundant anyway (AC_CHECK_LIB done that before,
AC_SEARCH_LIBS does it now).
* lib/xattr-at.c: Move the guarding macro a bit "up" to compile
less code.
* src/Makefile.am: Remove redundant -lattr from tar_LDADD.
---
 acinclude.m4    | 42 ++++++++++++++----------------------------
 lib/xattr-at.c  |  4 ++--
 src/Makefile.am |  4 ----
 3 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 3b28b3b..db0bbc7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -40,37 +40,23 @@ AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H],
   # First check for <sys/xattr.h>
   AC_CHECK_HEADERS([sys/xattr.h])
   AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_sys_xattr_h" = yes])
-  AM_CONDITIONAL([TAR_LIB_ATTR],[false])
-  if test "$ac_cv_header_sys_xattr_h" = yes; then
-    AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
-                   setxattr  fsetxattr  lsetxattr \
-                   listxattr flistxattr llistxattr,
-        # only when functions are present
-        AC_DEFINE([HAVE_SYS_XATTR_H], [1],
-                    [define to 1 if we have <sys/xattr.h> header])
-        if test "$with_xattrs" != no; then
-          AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
-        fi
-    )
-  fi
-
-  # If <sys/xattr.h> is not found, then check for <attr/xattr.h>
   if test "$ac_cv_header_sys_xattr_h" != yes; then
     AC_CHECK_HEADERS([attr/xattr.h])
     AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
-    AC_CHECK_LIB([attr],[fgetxattr])
-    AM_CONDITIONAL([TAR_LIB_ATTR],[test "$ac_cv_lib_attr_fgetxattr" = yes])
-    if test "$ac_cv_header_attr_xattr_h" = yes; then
-      AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
-                     setxattr  fsetxattr  lsetxattr \
-                     listxattr flistxattr llistxattr,
-          # only when functions are present
-          AC_DEFINE([HAVE_ATTR_XATTR_H], [1],
-                      [define to 1 if we have <attr/xattr.h> header])
-          if test "$with_xattrs" != no; then
-            AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
-          fi
-      )
+  fi
+
+  if test "$with_xattrs" != no; then
+    for i in getxattr  fgetxattr  lgetxattr \
+             setxattr  fsetxattr  lsetxattr \
+             listxattr flistxattr llistxattr
+    do
+      AC_SEARCH_LIBS($i, attr)
+      eval found=\$ac_cv_search_$i
+      test "$found" = "no" && break
+    done
+
+    if test "$found" != no; then
+      AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
     fi
   fi
 ])
diff --git a/lib/xattr-at.c b/lib/xattr-at.c
index 66427e9..8f59609 100644
--- a/lib/xattr-at.c
+++ b/lib/xattr-at.c
@@ -16,6 +16,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_XATTRS
+
 #include <config.h>
 
 #include "xattr-at.h"
@@ -31,8 +33,6 @@
 
 #include "openat-priv.h"
 
-#ifdef HAVE_XATTRS
-
 /* setxattrat */
 #define AT_FUNC_NAME setxattrat
 #define AT_FUNC_F1 setxattr
diff --git a/src/Makefile.am b/src/Makefile.am
index 82b2d46..42daaef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,3 @@ AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
 
 tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX)
-
-if TAR_LIB_ATTR
-tar_LDADD += -lattr
-endif
-- 
2.1.0

Reply via email to