Ticket #47814: patch-xattrs.diff

File patch-xattrs.diff, 3.9 KB (added by ryandesign (Ryan Carsten Schmidt), 9 years ago)
  • acinclude.m4

    >From 7d1d3d38cb66b02c062de77847e3c0ecd842366c Mon Sep 17 00:00:00 2001
    From: Pavel Raiskup <address@hidden>
    Date: Mon, 4 Aug 2014 13:19:49 +0200
    Subject: [PATCH] xattrs: fix bug in configure
    
    Be careful to define HAVE_XATTRS when not all needed xattr-related
    functions are properly defined either in libc or libattr.
    
    Reported independently by Denis Excoffier and Dominyk Tille.
    
    * acinclude.m4 (TAR_HEADERS_ATTR_XATTR_H): Check for each xattr
    function separately.  Don't AC_CHECK_LIB (LIBS is filled by
    AC_SEARCH_LIBS when necessary).
    * lib/xattr-at.c: Do not build when HAVE_XATTRS is not defined.
    * src/Makefile.am: The LDADD -lattr was redundant.
    ---
     acinclude.m4    | 42 ++++++++++++++----------------------------
     lib/xattr-at.c  |  7 +++++++
     src/Makefile.am |  4 ----
     3 files changed, 21 insertions(+), 32 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 3b28b3b..db0bbc7 100644
    a b AC_DEFUN([TAR_HEADERS_ATTR_XATTR_H], 
    4040  # First check for <sys/xattr.h>
    4141  AC_CHECK_HEADERS([sys/xattr.h])
    4242  AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_sys_xattr_h" = yes])
    43   AM_CONDITIONAL([TAR_LIB_ATTR],[false])
    44   if test "$ac_cv_header_sys_xattr_h" = yes; then
    45     AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
    46                    setxattr  fsetxattr  lsetxattr \
    47                    listxattr flistxattr llistxattr,
    48         # only when functions are present
    49         AC_DEFINE([HAVE_SYS_XATTR_H], [1],
    50                     [define to 1 if we have <sys/xattr.h> header])
    51         if test "$with_xattrs" != no; then
    52           AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
    53         fi
    54     )
    55   fi
    56 
    57   # If <sys/xattr.h> is not found, then check for <attr/xattr.h>
    5843  if test "$ac_cv_header_sys_xattr_h" != yes; then
    5944    AC_CHECK_HEADERS([attr/xattr.h])
    6045    AM_CONDITIONAL([TAR_COND_XATTR_H],[test "$ac_cv_header_attr_xattr_h" = yes])
    61     AC_CHECK_LIB([attr],[fgetxattr])
    62     AM_CONDITIONAL([TAR_LIB_ATTR],[test "$ac_cv_lib_attr_fgetxattr" = yes])
    63     if test "$ac_cv_header_attr_xattr_h" = yes; then
    64       AC_CHECK_FUNCS(getxattr  fgetxattr  lgetxattr \
    65                      setxattr  fsetxattr  lsetxattr \
    66                      listxattr flistxattr llistxattr,
    67           # only when functions are present
    68           AC_DEFINE([HAVE_ATTR_XATTR_H], [1],
    69                       [define to 1 if we have <attr/xattr.h> header])
    70           if test "$with_xattrs" != no; then
    71             AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
    72           fi
    73       )
     46  fi
     47
     48  if test "$with_xattrs" != no; then
     49    for i in getxattr  fgetxattr  lgetxattr \
     50             setxattr  fsetxattr  lsetxattr \
     51             listxattr flistxattr llistxattr
     52    do
     53      AC_SEARCH_LIBS($i, attr)
     54      eval found=\$ac_cv_search_$i
     55      test "$found" = "no" && break
     56    done
     57
     58    if test "$found" != no; then
     59      AC_DEFINE([HAVE_XATTRS],,[Define when we have working linux xattrs.])
    7460    fi
    7561  fi
    7662])
  • lib/xattr-at.c

    diff --git a/lib/xattr-at.c b/lib/xattr-at.c
    index 443ccae..009bde5 100644
    a b  
    1818
    1919#include <config.h>
    2020
     21/* Temporarily don't build.  We are unable to build on (probably not only)
     22   darwin due to lack of l*xattr callbacks (XATTR_NOFOLLOW is alternative) and
     23   different function definitions. */
     24#ifdef HAVE_XATTRS
     25
    2126#include "xattr-at.h"
    2227#include "openat.h"
    2328
     
    108113#undef AT_FUNC_RESULT
    109114#undef AT_FUNC_POST_FILE_PARAM_DECLS
    110115#undef AT_FUNC_POST_FILE_ARGS
     116
     117#endif
  • src/Makefile.am

    diff --git a/src/Makefile.am b/src/Makefile.am
    index 82b2d46..42daaef 100644
    a b AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) 
    5252LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
    5353
    5454tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) $(LIB_EACCESS) $(LIB_SELINUX)
    55 
    56 if TAR_LIB_ATTR
    57 tar_LDADD += -lattr
    58 endif