From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:58598) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ilk7F-0004zO-A2 for guix-patches@gnu.org; Sun, 29 Dec 2019 20:45:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ilk7C-0002JC-M2 for guix-patches@gnu.org; Sun, 29 Dec 2019 20:45:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:54408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ilk7C-0002Iz-Ie for guix-patches@gnu.org; Sun, 29 Dec 2019 20:45:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ilk7C-0004Fu-GQ for guix-patches@gnu.org; Sun, 29 Dec 2019 20:45:02 -0500 Subject: [bug#38803] [PATCH] gnu: elfutils: Update to 0.178 Resent-Message-ID: Date: Mon, 30 Dec 2019 01:44:21 +0000 (UTC) From: Brett Gilio Message-ID: In-Reply-To: <20191230014101.2425-1-mark@klomp.org> References: <20191230014101.2425-1-mark@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Mark Wielaard Cc: 38803@debbugs.gnu.org Dec 29, 2019 7:42:34 PM Mark Wielaard : > This introduces debuginfod support which requires a couple of new inputs. > > * gnu/packages/elf.scm (elfutils): Update to 0.178 > [native-inputs]: Add iproute and pkg-config. > [inputs]: Add cpio, libarchive, libmicrohttpd, libcurl, rpm and sqlite. > * gnu/packages/patches/elfutils-tests-ptrace.patch: Removed. Fixed upstre= am. > * gnu/packages/patches/elfutils-0.178-tests-build-id.patch: New. Patches > backported from upstream git. > --- > gnu/packages/elf.scm | 26 ++- > .../elfutils-0.178-tests-build-id.patch | 159 ++++++++++++++++++ > .../patches/elfutils-tests-ptrace.patch | 64 ------- > 3 files changed, 180 insertions(+), 69 deletions(-) > create mode 100644 gnu/packages/patches/elfutils-0.178-tests-build-id.pat= ch > delete mode 100644 gnu/packages/patches/elfutils-tests-ptrace.patch > > diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm > index 75caa54296..169e8d1af8 100644 > --- a/gnu/packages/elf.scm > +++ b/gnu/packages/elf.scm > @@ -6,6 +6,7 @@ > ;;; Copyright =C2=A9 2017 Leo Famulari > ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice > ;;; Copyright =C2=A9 2018 Marius Bakke > +;;; Copyright =C2=A9 2019 Mark Wielaard > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -29,28 +30,35 @@ > #:use-module (guix build-system gnu) > #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+)) > #:use-module (gnu packages) > + #:use-module (gnu packages backup) > #:use-module (gnu packages compression) > + #:use-module (gnu packages cpio) > + #:use-module (gnu packages curl) > #:use-module (gnu packages documentation) > #:use-module (gnu packages gcc) > + #:use-module (gnu packages gnunet) ; for libmicrohttpd > + #:use-module (gnu packages linux) ; for iproute > #:use-module (gnu packages m4) > + #:use-module (gnu packages package-management) ; for rpm > #:use-module (gnu packages pkg-config) > #:use-module (gnu packages python) > #:use-module (gnu packages sphinx) > + #:use-module (gnu packages sqlite) > #:use-module (gnu packages texinfo) > #:use-module (gnu packages xml)) > > (define-public elfutils > (package > (name "elfutils") > - (version "0.176") > + (version "0.178") > (source (origin > (method url-fetch) > (uri (string-append "https://sourceware.org/elfutils/ftp/" > version "/elfutils-" version ".tar.bz2")) > (sha256 > (base32 > - "08qhrl4g6qqr4ga46jhh78y56a47p3msa5b2x1qhzbxhf71lfmzb")) > - (patches (search-patches "elfutils-tests-ptrace.patch")))) > + "1wm0yfcih4rjwbg59qgm4jyqmbsdmk6z5qajljyw9sfljq7a1rri")) > + (patches (search-patches "elfutils-0.178-tests-build-id.patch")))) > (build-system gnu-build-system) > > ;; Separate programs because that's usually not what elfutils users want, > @@ -81,8 +89,16 @@ > (("run-backtrace-native.sh") "")) > #t))))) > > - (native-inputs `(("m4" ,m4))) > - (inputs `(("zlib" ,zlib))) > + (native-inputs `(("iproute", iproute) ;; needed in tests for ss > + ("m4", m4) > + ("pkg-config", pkg-config))) > + (inputs `(("cpio", cpio) > + ("libarchive", libarchive) > + ("libmicrohttpd", libmicrohttpd) > + ("libcurl", curl) > + ("rpm", rpm) > + ("sqlite", sqlite) > + ("zlib" ,zlib))) > (home-page "https://sourceware.org/elfutils/") > (synopsis "Linker and ELF manipulation tools") > (description > diff --git a/gnu/packages/patches/elfutils-0.178-tests-build-id.patch b/g= nu/packages/patches/elfutils-0.178-tests-build-id.patch > new file mode 100644 > index 0000000000..ca9bd480b8 > --- /dev/null > +++ b/gnu/packages/patches/elfutils-0.178-tests-build-id.patch > @@ -0,0 +1,159 @@ > +commit 3f445279b60b16b6cb062921b74ae400344b4a68 > +Author: Mark Wielaard > +Date: Thu Dec 5 14:22:56 2019 +0100 > + > + tests: Run elfcompress under testrun in run-elfclassify.sh > + > + Otherwise elfcompress might run against the system libelf which might > + be too old or missing. > + > + Signed-off-by: Mark Wielaard > + > +diff --git a/tests/run-elfclassify.sh b/tests/run-elfclassify.sh > +index 5a849bbd..fb14139d 100755 > +--- a/tests/run-elfclassify.sh > ++++ b/tests/run-elfclassify.sh > +@@ -267,7 +267,7 @@ $(echo $kmod_files | sed -e "s/ /\n/g") > + EOF > + > + echo "gnu compressed kmods are unstripped" > +-${abs_top_builddir}/src/elfcompress -t gnu --force $kmod_files > ++testrun ${abs_top_builddir}/src/elfcompress -t gnu --force $kmod_files > + testrun ${abs_top_builddir}/src/elfclassify --unstripped $kmod_files > + testrun_compare ${abs_top_builddir}/src/elfclassify --unstripped --prin= t $kmod_files < > + $(echo $kmod_files | sed -e "s/ /\n/g") > +@@ -312,7 +312,7 @@ $(echo $debug_files | sed -e "s/ /\n/g") > + EOF > + > + echo "compress the debug sections and try again" > +-${abs_top_builddir}/src/elfcompress -t gnu --force $debug_files > ++testrun ${abs_top_builddir}/src/elfcompress -t gnu --force $debug_files > + > + echo "again unstripped" > + testrun ${abs_top_builddir}/src/elfclassify --unstripped $debug_files > + > +commit eaffa79d52da7454044be53d28b525cebdb0093b > +Author: Mark Wielaard > +Date: Fri Dec 6 15:48:00 2019 +0100 > + > + tests: Run strip under testrun in run-debuginfod-find.sh > + > + Otherwise strip might run against the system libelf which might be too > + old or missing. > + > + Signed-off-by: Mark Wielaard > + > +diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh > +index 0ade03b7..6f92fbf1 100755 > +--- a/tests/run-debuginfod-find.sh > ++++ b/tests/run-debuginfod-find.sh > +@@ -102,7 +102,7 @@ export DEBUGINFOD_TIMEOUT=3D10 > + echo "int main() { return 0; }" > ${PWD}/prog.c > + tempfiles prog.c > + gcc -g -o prog ${PWD}/prog.c > +- ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog > ++testrun ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog > + BUILDID=3D`env LD_LIBRARY_PATH=3D$ldpath ${abs_builddir}/../src/readelf= \ > + -a prog | grep 'Build ID' | cut -d ' ' -f 7` > + > + > +commit cf1b5fe170fa24f32871ef284ff2968c73816f98 > +Author: Mark Wielaard > +Date: Fri Dec 6 17:20:00 2019 +0100 > + > + Make sure to always build with build-ids. > + > + We really need build-ids for various things. If the system compiler > + doesn't generate build-ids warn and generate them anyway for both the > + binaries and the tests. > + > + Signed-off-by: Mark Wielaard > + > +diff --git a/configure.ac b/configure.ac > +index 5a2dc373..36a6b6c2 100644 > +--- a/configure.ac > ++++ b/configure.ac > +@@ -197,6 +197,15 @@ if test "$ac_cv_zdefs" =3D "yes"; then > + dso_LDFLAGS=3D"$dso_LDFLAGS $ZDEFS_LDFLAGS" > + fi > + > ++# We really want build-ids. Warn and force generating them if gcc was > ++# configure without --enable-linker-build-id > ++AC_CACHE_CHECK([whether the compiler generates build-ids], ac_cv_buildi= d, [dnl > ++AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=3Dyes; readelf -n con= ftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=3Dno],AC_MSG_FAILUR= E([unexpected compile failure]))]) > ++if test "$ac_cv_buildid" =3D "no"; then > ++ AC_MSG_WARN([compiler doesn't generate build-id by default]) > ++ LDFLAGS=3D"$LDFLAGS -Wl,--build-id" > ++fi > ++ > + ZRELRO_LDFLAGS=3D"-Wl,-z,relro" > + AC_CACHE_CHECK([whether gcc supports $ZRELRO_LDFLAGS], ac_cv_zrelro, [d= nl > + save_LDFLAGS=3D"$LDFLAGS" > +diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh > +index 6f92fbf1..6533996a 100755 > +--- a/tests/run-debuginfod-find.sh > ++++ b/tests/run-debuginfod-find.sh > +@@ -101,7 +101,7 @@ export DEBUGINFOD_TIMEOUT=3D10 > + # cannot find it without debuginfod. > + echo "int main() { return 0; }" > ${PWD}/prog.c > + tempfiles prog.c > +-gcc -g -o prog ${PWD}/prog.c > ++gcc -Wl,--build-id -g -o prog ${PWD}/prog.c > + testrun ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog > + BUILDID=3D`env LD_LIBRARY_PATH=3D$ldpath ${abs_builddir}/../src/readelf= \ > + -a prog | grep 'Build ID' | cut -d ' ' -f 7` > +@@ -138,7 +138,7 @@ cmp $filename ${PWD}/prog.c > + # Build another, non-stripped binary > + echo "int main() { return 0; }" > ${PWD}/prog2.c > + tempfiles prog2.c > +-gcc -g -o prog2 ${PWD}/prog2.c > ++gcc -Wl,--build-id -g -o prog2 ${PWD}/prog2.c > + BUILDID2=3D`env LD_LIBRARY_PATH=3D$ldpath ${abs_builddir}/../src/readel= f \ > + -a prog2 | grep 'Build ID' | cut -d ' ' -f 7` > + > +--- a/configure 1970-01-01 01:00:00.000000000 +0100 > ++++ b/configure 2019-12-11 14:18:11.812008097 +0100 > +@@ -5325,6 +5325,43 @@ > + dso_LDFLAGS=3D"$dso_LDFLAGS $ZDEFS_LDFLAGS" > + fi > + > ++# We really want build-ids. Warn and force generating them if gcc was > ++# configure without --enable-linker-build-id > ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler = generates build-ids" >&5 > ++$as_echo_n "checking whether the compiler generates build-ids... " >&6;= } > ++if ${ac_cv_buildid+:} false; then : > ++ $as_echo_n "(cached) " >&6 > ++else > ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext > ++/* end confdefs.h. */ > ++ > ++int > ++main () > ++{ > ++ > ++ ; > ++ return 0; > ++} > ++_ACEOF > ++if ac_fn_c_try_link "$LINENO"; then : > ++ ac_cv_buildid=3Dyes; readelf -n conftest$EXEEXT | grep -q NT_GNU_BUILD= _ID || ac_cv_buildid=3Dno > ++else > ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 > ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} > ++as_fn_error $? "unexpected compile failure > ++See \`config.log' for more details" "$LINENO" 5; } > ++fi > ++rm -f core conftest.err conftest.$ac_objext \ > ++ conftest$ac_exeext conftest.$ac_ext > ++fi > ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_buildid" >&5 > ++$as_echo "$ac_cv_buildid" >&6; } > ++if test "$ac_cv_buildid" =3D "no"; then > ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: compiler doesn't gen= erate build-id by default" >&5 > ++$as_echo "$as_me: WARNING: compiler doesn't generate build-id by defaul= t" >&2;} > ++ LDFLAGS=3D"$LDFLAGS -Wl,--build-id" > ++fi > ++ > + ZRELRO_LDFLAGS=3D"-Wl,-z,relro" > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc supports = $ZRELRO_LDFLAGS" >&5 > + $as_echo_n "checking whether gcc supports $ZRELRO_LDFLAGS... " >&6; } > diff --git a/gnu/packages/patches/elfutils-tests-ptrace.patch b/gnu/packa= ges/patches/elfutils-tests-ptrace.patch > deleted file mode 100644 > index cd46999063..0000000000 > --- a/gnu/packages/patches/elfutils-tests-ptrace.patch > +++ /dev/null > @@ -1,64 +0,0 @@ > -This patch allows us to skip tests that require PTRACE_ATTACH in situati= ons > -where PTRACE_ATTACH is only allowed when CAP_SYS_PTRACE is held (i.e., f= or > -root, by default.) > - > -Reported at . > - > ---- elfutils-0.161/tests/run-deleted.sh 2015-04-11 16:38:33.028556235 +0= 200 > -+++ elfutils-0.161/tests/run-deleted.sh 2015-04-11 16:46:15.012442185 +0= 200 > -@@ -17,6 +17,15 @@ > - > - . $srcdir/backtrace-subr.sh > - > -+# Check whether the Yama policy allows us to use PTRACE_ATTACH. > -+if [ -f /proc/sys/kernel/yama/ptrace_scope ] > -+then > -+ if [ `cat /proc/sys/kernel/yama/ptrace_scope` -ne 0 ] > -+ then > -+ exit 77 > -+ fi > -+fi > -+ > - tempfiles deleted deleted-lib.so > - cp -p ${abs_builddir}/deleted ${abs_builddir}/deleted-lib.so . > - > ---- elfutils-0.161/tests/vdsosyms.c 2015-04-11 16:40:20.633461110 +0200 > -+++ elfutils-0.161/tests/vdsosyms.c 2015-04-11 16:45:06.611866677 +0200 > -@@ -23,6 +23,8 @@ > - #include > - #include > - #include > -+#include > -+#include > - #include > - #include ELFUTILS_HEADER(dwfl) > - > -@@ -68,6 +70,7 @@ module_callback (Dwfl_Module *mod, void > - int > - main (int argc __attribute__ ((unused)), char **argv __attribute__ ((un= used))) > - { > -+ static const char ptrace_scope_file[] =3D "/proc/sys/kernel/yama/ptrac= e_scope"; > - static char *debuginfo_path; > - static const Dwfl_Callbacks proc_callbacks =3D > - { > -@@ -76,6 +79,20 @@ main (int argc __attribute__ ((unused)), > - > - .find_elf =3D dwfl_linux_proc_find_elf, > - }; > -+ > -+ /* Check whether the Yama policy allows us to use PTRACE_ATTACH. */ > -+ int ptrace_scope =3D open (ptrace_scope_file, O_RDONLY); > -+ if (ptrace_scope >=3D 0) > -+ { > -+ char buf[10]; > -+ int count =3D read (ptrace_scope, buf, sizeof buf); > -+ assert (count > 0); > -+ if (buf[0] !=3D '0') > -+ /* We're not allowed, so skip this test. */ > -+ return 77; > -+ close (ptrace_scope); > -+ } > -+ > - Dwfl *dwfl =3D dwfl_begin (&proc_callbacks); > - if (dwfl =3D=3D NULL) > - error (2, 0, "dwfl_begin: %s", dwfl_errmsg (-1)); > -- > 2.20.1 > Hi Mark! Funny you submitted this, I was working on the same package about = an hour ago. We must be reading each other's minds. You got significantly f= arther than I did. One thing I did do differently was that I extended the l= ist of licenses to include the ones mentioned in the comment. I'll look at your patch, and hopefully this will be ready for core-updates.= Thank you :) --=20 Brett M. Gilio GNU Guix, Contributor | GNU Project, Webmaster [DFC0 C7F7 9EE6 0CA7 AE55 5E19 6722 43C4 A03F 0EEE] < brettg@gnu.org [mailto:brettg@gnu.org] > < brettg@posteo.net [mailto:bret= tg@posteo.net] >