Summary: | app-arch/tar-1.27.1[xattr]: Incorrect dependency / Needless usage of attr/xattr.h | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Arfrever Frehtes Taifersar Arahesis <arfrever.fta> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
URL: | https://savannah.gnu.org/patch/index.php?8252 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
Use <sys/xattr.h> and link against libc OR use <attr/xattr.h> and link against libattr.so
Patch as submitted upstream. |
Description
Arfrever Frehtes Taifersar Arahesis
2013-10-23 15:19:05 UTC
Build system should look for both sys/xattr.h, and if it is not found, then for attr/xattr.h. When only attr/xattr.h is found, then build system should enable linking against -lattr. Ebuild should have "!elibc_glibc? ( xattr? ( sys-apps/attr ) )" dependency. Source files should have something similar to: #if defined(HAVE_SYS_XATTR_H) #include <sys/xattr.h> #elif defined(HAVE_ATTR_XATTR_H) #include <attr/xattr.h> #endif (In reply to Arfrever Frehtes Taifersar Arahesis from comment #1) > Build system should look for both sys/xattr.h, and if it is not found, then > for attr/xattr.h. When only attr/xattr.h is found, then build system should > enable linking against -lattr. > Ebuild should have "!elibc_glibc? ( xattr? ( sys-apps/attr ) )" dependency. > > Source files should have something similar to: > > #if defined(HAVE_SYS_XATTR_H) > #include <sys/xattr.h> > #elif defined(HAVE_ATTR_XATTR_H) > #include <attr/xattr.h> > #endif Correct, because on a uclibc system you need that dependency. So please provide a working patch here and/or report this upstream. Meanwhile I added tar-1.27-r2 to the tree where sys-apps/attr was moved from RDEPEND to DEPEND. (In reply to Lars Wendler (Polynomial-C) from comment #3) > So please provide a working patch here and/or report this upstream. > > Meanwhile I added tar-1.27-r2 to the tree where sys-apps/attr was moved from > RDEPEND to DEPEND. Okay I've got a patch and ebuild on the hardened-dev::uclibc overlay. For the patch take a look at: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=blob;f=app-arch/tar/files/tar-1.27.1-sys-attr.patch;h=d999fd91c34995130e39e4a9e33c5c8f72f21425;hb=bab4d804668603d12366ee3d0d5e295dbebf39b8 and for the ebuild take a look at http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=blob;f=app-arch/tar/tar-1.27.1-r99.ebuild;h=c8a8853fa42298bfb22b8a0c5367c2dd11c5b993;hb=bab4d804668603d12366ee3d0d5e295dbebf39b8 We should probably push the patch upstream. Let me do some testing first. There was a slight error in that patch. I'll upload a better one in a minute. But here are the results of my testing of the 4 possible combinations: xattrs provided by uclibc X xattrs provided by sys-apps/attr: 1) Both sources of xattr: uclibc with UCLIBC_HAS_XATTR=y libattr.so from sys-apps/attr a) both header available, but only <sys/attr.h> used, as expected. uclibc # cat config.h | grep XATTR_H /* #undef HAVE_ATTR_XATTR_H */ #define HAVE_SYS_XATTR_H 1 b) symbols link against uclibc, as expected: uclibc# ldd /bin/tar checking sub-depends for '/lib/libiconv.so.2' checking sub-depends for '/usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1' checking sub-depends for '/lib/libc.so.0' libiconv.so.2 => /lib/libiconv.so.2 (0x00000000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1 (0x00000000) libc.so.0 => /lib/libc.so.0 (0x00000000) /lib/ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x00000000) uclibc# readelf -sW /bin/tar | grep attr 14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND llistxattr 21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lsetxattr 23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetxattr 90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND listxattr 131: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetxattr 150: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setxattr 168: 0000000000000000 0 FUNC GLOBAL DEFAULT UND flistxattr 193: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getxattr 305: 0000000000279190 4 OBJECT GLOBAL DEFAULT 24 xattrs_option c) Works: uclibc yellow ~ # tar --xattrs -xf zzz.tar uclibc yellow ~ # getfattr -d zzz/zzz # file: zzz/zzz user.hi="hi" ================================================================================ 2) Only uclibc as a source: uclibc with UCLIBC_HAS_XATTR=y un-emerged sys-apps/attr a) only <sys/attr.h> available and used, as expected: uclibc# cat config.h | grep XATTR_H /* #undef HAVE_ATTR_XATTR_H */ #define HAVE_SYS_XATTR_H 1 b) symbols link against uclibc, as expected: uclibc# ldd /bin/tar checking sub-depends for '/lib/libiconv.so.2' checking sub-depends for '/usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1' checking sub-depends for '/lib/libc.so.0' libiconv.so.2 => /lib/libiconv.so.2 (0x00000000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1 (0x00000000) libc.so.0 => /lib/libc.so.0 (0x00000000) /lib/ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x00000000) uclibc# readelf -sW /bin/tar | grep attr 14: 0000000000000000 0 FUNC GLOBAL DEFAULT UND llistxattr 21: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lsetxattr 23: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetxattr 90: 0000000000000000 0 FUNC GLOBAL DEFAULT UND listxattr 131: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetxattr 150: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setxattr 168: 0000000000000000 0 FUNC GLOBAL DEFAULT UND flistxattr 193: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getxattr 305: 0000000000279190 4 OBJECT GLOBAL DEFAULT 24 xattrs_option c) Works --- I ran getfattr from outside a chroot since sys-apps/attr was un-emerged uclibc# tar --xattrs -xf zzz.tar uclibc# getfattr -d zzz/zzz # file: zzz/zzz user.hi="hi" ================================================================================ 3) No xattr source: uclibc with # UCLIBC_HAS_XATTR is not set un-emerged sys-apps/attr a) no header available: uclibc yellow tar-1.27 # cat config.h | grep ATTR_H /* #undef HAVE_ATTR_XATTR_H */ /* #undef HAVE_SYS_XATTR_H */ b) no symbols: uclibc# ldd /bin/tar checking sub-depends for '/lib/libiconv.so.2' checking sub-depends for '/usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1' checking sub-depends for '/lib/libc.so.0' libiconv.so.2 => /lib/libiconv.so.2 (0x00000000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1 (0x00000000) libc.so.0 => /lib/libc.so.0 (0x00000000) /lib/ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x00000000) uclibc# readelf -sW /bin/tar | grep attr 297: 0000000000278170 4 OBJECT GLOBAL DEFAULT 24 xattrs_option c) doesn't work, as expected: uclibc yellow ~ # tar --xattrs -xf zzz.tar tar: XATTR support is not available ================================================================================ 4) Only sys-apps/attr as a source: a) only <attr/attr.h> availabe and used, as expected: uclibc yellow tar-1.27 # cat config.h | grep ATTR_H #define HAVE_ATTR_XATTR_H 1 /* #undef HAVE_SYS_XATTR_H */ b) symbols link against /lib/libattr.so.1, as expected: uclibc yellow ~ # ldd /bin/tar checking sub-depends for '/lib/libattr.so.1' checking sub-depends for '/lib/libiconv.so.2' checking sub-depends for '/usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1' checking sub-depends for '/lib/libc.so.0' libattr.so.1 => /lib/libattr.so.1 (0x00000000) libiconv.so.2 => /lib/libiconv.so.2 (0x00000000) libgcc_s.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-uclibc/4.7.3/libgcc_s.so.1 (0x00000000) libc.so.0 => /lib/libc.so.0 (0x00000000) /lib/ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x00000000) uclibc yellow ~ # readelf -sW /bin/tar | grep attr 32: 0000000000000000 0 FUNC GLOBAL DEFAULT UND llistxattr@ATTR_1.0 (2) 60: 0000000000000000 0 FUNC GLOBAL DEFAULT UND listxattr@ATTR_1.0 (2) 71: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lgetxattr@ATTR_1.0 (2) 133: 0000000000000000 0 FUNC GLOBAL DEFAULT UND lsetxattr@ATTR_1.0 (2) 149: 0000000000000000 0 FUNC GLOBAL DEFAULT UND getxattr@ATTR_1.0 (2) 152: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fgetxattr@ATTR_1.0 (2) 163: 0000000000000000 0 FUNC GLOBAL DEFAULT UND setxattr@ATTR_1.0 (2) 199: 0000000000000000 0 FUNC GLOBAL DEFAULT UND flistxattr@ATTR_1.0 (2) 305: 0000000000279190 4 OBJECT GLOBAL DEFAULT 24 xattrs_option c) Works: uclibc yellow ~ # tar --xattrs -xf zzz.tar uclibc yellow ~ # getfattr -d zzz/zzz # file: zzz/zzz user.hi="hi" Created attachment 364152 [details, diff] Use <sys/xattr.h> and link against libc OR use <attr/xattr.h> and link against libattr.so This patch and the ebuild are on the hardened-dev::uclibc overlay at http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=tree;f=app-arch/tar;hb=205e02b3575f70b143d4dbee0961fc472ab5aecb Note, I've dropped DEPEND="xattr? ( sys-apps/attr )". Here's a diff with the in tree ebuild: diff -Naur tar-1.27.1-r99.ebuild /usr/portage/app-arch/tar/tar-1.27.1.ebuild --- tar-1.27.1-r99.ebuild 2013-11-28 20:20:16.061585124 +0000 +++ /usr/portage/app-arch/tar/tar-1.27.1.ebuild 2013-11-25 12:20:59.000000000 +0000 @@ -2,9 +2,9 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.27.1.ebuild,v 1.1 2013/11/25 12:20:59 polynomial-c Exp $ -EAPI="5" +EAPI="3" -inherit autotools flag-o-matic eutils +inherit flag-o-matic eutils DESCRIPTION="Use this to make tarballs :)" HOMEPAGE="http://www.gnu.org/software/tar/" @@ -19,12 +19,10 @@ RDEPEND="acl? ( virtual/acl ) selinux? ( sys-libs/libselinux )" DEPEND="${RDEPEND} - nls? ( >=sys-devel/gettext-0.10.35 )" + nls? ( >=sys-devel/gettext-0.10.35 ) + xattr? ( sys-apps/attr )" src_prepare() { - epatch "${FILESDIR}"/${P}-sys-attr.patch - eautoreconf - if ! use userland_GNU ; then sed -i \ -e 's:/backup\.sh:/gbackup.sh:' \ (In reply to Anthony Basile from comment #6) > diff -Naur tar-1.27.1-r99.ebuild > /usr/portage/app-arch/tar/tar-1.27.1.ebuild > --- tar-1.27.1-r99.ebuild 2013-11-28 20:20:16.061585124 +0000 > +++ /usr/portage/app-arch/tar/tar-1.27.1.ebuild 2013-11-25 > 12:20:59.000000000 +0000 > @@ -2,9 +2,9 @@ > # Distributed under the terms of the GNU General Public License v2 > # $Header: /var/cvsroot/gentoo-x86/app-arch/tar/tar-1.27.1.ebuild,v 1.1 > 2013/11/25 12:20:59 polynomial-c Exp $ > > -EAPI="5" > +EAPI="3" > > -inherit autotools flag-o-matic eutils > +inherit flag-o-matic eutils > > DESCRIPTION="Use this to make tarballs :)" > HOMEPAGE="http://www.gnu.org/software/tar/" > @@ -19,12 +19,10 @@ > RDEPEND="acl? ( virtual/acl ) > selinux? ( sys-libs/libselinux )" > DEPEND="${RDEPEND} > - nls? ( >=sys-devel/gettext-0.10.35 )" > + nls? ( >=sys-devel/gettext-0.10.35 ) > + xattr? ( sys-apps/attr )" > > src_prepare() { > - epatch "${FILESDIR}"/${P}-sys-attr.patch > - eautoreconf > - > if ! use userland_GNU ; then > sed -i \ > -e 's:/backup\.sh:/gbackup.sh:' \ Oops! Thats the reverse diff. That's okay, its just there to make it easy for you to read what I did with the ebuild. blueness, thanks for looking into this. I won't pretend to understand much of the patch. How about you submit it upstream for approval? The patch looks correct. Minor suggestion about acinclude.m4: When user explicitly passes --with-xattrs but no xattr implementation is found, then AC_MSG_ERROR should be called. Upstream at https://savannah.gnu.org/patch/index.php?8252. Created attachment 364738 [details, diff]
Patch as submitted upstream.
Note: upstream uses the usual GNU bootstrap script, so you don't need to patch config.h.in as in my original patch.
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #9) > The patch looks correct. > > Minor suggestion about acinclude.m4: > When user explicitly passes --with-xattrs but no xattr implementation is > found, then AC_MSG_ERROR should be called. I debated this because I reproduced the original behavior. If no xattr support is found, tar still builds but just fails when invoked with --xattr. Let's see what upstream says, its a trivial addition. A new patch has been sent upstream: http://lists.gnu.org/archive/html/bug-tar/2013-12/msg00023.html Its a deep rewrite of the previous patch, but I did test it. Arfrever, any comments? Upstream has repsonded yet and I'm going to ping them soon. I suggest to apply this new patch in Gentoo. +*tar-1.27.1-r1 (10 Jan 2014) + + 10 Jan 2014; Lars Wendler <polynomial-c@gentoo.org> +tar-1.27.1-r1.ebuild, + +files/tar-1.27.1-recursion_norecursion.patch, + +files/tar-1.27.1-xattr_build_fix.patch: + Fixed build with xattr (bug #489170). Added an upstream fix regarding + recursion/norecursion. + |