diff --git a/PR29474-debuginfod.patch b/PR29474-debuginfod.patch new file mode 100644 index 0000000..bcc3660 --- /dev/null +++ b/PR29474-debuginfod.patch @@ -0,0 +1,50 @@ +From 31d6b1fe74ab89138b4d256742997b730dc5cba8 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Mon, 15 Aug 2022 06:20:10 -0400 +Subject: [PATCH] PR29474: debuginfod +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Previous code sometimes confused debuginfod with concurrent queries +targeting the same RPM. One thread fetching & prefetching, the other +thread misinterpreted the sudden presence of its target file in the +fdcache as a mere unnecessary prefetch duplicate. But if it was the +other thread's target file, previous code would -skip- it completely, +resulting in a 404 error. New code allows the other thread to also +decompress the target file and return it, and still continue to its +own prefetching process for other files. + +There's a performance trade-off here. Another option would be for the +other thread to check the fdcache regularly and abort its own +prefetch/fetch/prefetch loop early in case of a sudden target file +hit. That'd save CPU probably but it'd stop prefetching of later +segments of the input archive, which could save future time. + +Automated testing is too time/load sensitive to attempt. Confirmed +working with Martin's stress tester. + +Reported-By: Martin Liška +Signed-Off-By: Frank Ch. Eigler +--- + debuginfod/ChangeLog | 6 ++++++ + debuginfod/debuginfod.cxx | 3 ++- + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx +index a089d0bd..9245be53 100644 +--- a/debuginfod/debuginfod.cxx ++++ b/debuginfod/debuginfod.cxx +@@ -1742,7 +1742,8 @@ handle_buildid_r_match (bool internal_req_p, + if ((r == 0) && (fn != b_source1)) // stage 1 + continue; + +- if (fdcache.probe (b_source0, fn)) // skip if already interned ++ if (fdcache.probe (b_source0, fn) && // skip if already interned ++ fn != b_source1) // but only if we'd just be prefetching, PR29474 + continue; + + // extract this file to a temporary file +-- +2.37.1 + diff --git a/elfutils-debuginfod.changes b/elfutils-debuginfod.changes index e57eb6c..e976acc 100644 --- a/elfutils-debuginfod.changes +++ b/elfutils-debuginfod.changes @@ -1,3 +1,25 @@ +------------------------------------------------------------------- +Wed Aug 17 11:42:11 UTC 2022 - Martin Liška + +- Use %ghost for debuginfod.sqlite file. + +------------------------------------------------------------------- +Tue Aug 16 13:29:30 UTC 2022 - Martin Liška + +- Add support-nullglob-in-profile.-.in-files.patch + fixes boo#1202440. + +------------------------------------------------------------------- +Mon Aug 15 11:04:57 UTC 2022 - Martin Liška + +- Add PR29474-debuginfod.patch in order to fix PR29474. + +------------------------------------------------------------------- +Fri Aug 12 12:35:57 UTC 2022 - Martin Liška + +- Add Recommends for libdebuginfod1 so that debuginfod-profile + sets the DEBUGINFOD_URLS. + ------------------------------------------------------------------- Wed Jun 15 11:28:34 UTC 2022 - Martin Liška diff --git a/elfutils-debuginfod.spec b/elfutils-debuginfod.spec index 1371527..17a752f 100644 --- a/elfutils-debuginfod.spec +++ b/elfutils-debuginfod.spec @@ -31,6 +31,8 @@ Source3: elfutils.keyring Source4: %{name}.sysusers Patch1: harden_debuginfod.service.patch Patch2: config-Move-the-2-dev-null-inside-the-sh-c-quotes-fo.patch +Patch3: PR29474-debuginfod.patch +Patch4: support-nullglob-in-profile.-.in-files.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bison @@ -73,6 +75,7 @@ Summary: Library for build-id HTTP ELF/DWARF server Group: System/Libraries Conflicts: libdebuginfod1-dummy = %{version} License: GPL-2.0-or-later OR LGPL-3.0-or-later +Recommends: debuginfod-profile %description -n libdebuginfod1 The libdebuginfod1 package contains shared libraries @@ -193,7 +196,7 @@ export XFAIL_TESTS="dwfl-proc-attach run-backtrace-dwarf.sh run-backtrace-native %{_sysusersdir}/%{name}.conf %dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod -%verify(not md5 size mtime) %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite +%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite %files -n libdebuginfod1 %{_libdir}/libdebuginfod.so.* diff --git a/support-nullglob-in-profile.-.in-files.patch b/support-nullglob-in-profile.-.in-files.patch new file mode 100644 index 0000000..e29b6ff --- /dev/null +++ b/support-nullglob-in-profile.-.in-files.patch @@ -0,0 +1,48 @@ +From 538f0c744dd4e1d931b98d01425b45137afcd9a4 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Tue, 16 Aug 2022 15:14:26 +0200 +Subject: [PATCH] Support nullglob in profile.*.in files + +In openSUSE we have the following RPM checker that uses +shopt -s nullglob: +https://github.com/openSUSE/post-build-checks/blob/master/checks/50-check-libtool-deps#L31 + +The script loads all /etc/profile.d/*.sh files via source $FILE which +can end up by stuck cat (with no arguments): + +shopt -s nullglob ; cat "/etc/debuginfod"/*.urls +(stuck) +--- + config/profile.csh.in | 2 +- + config/profile.sh.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config/profile.csh.in b/config/profile.csh.in +index 74c20c99..d962d969 100644 +--- a/config/profile.csh.in ++++ b/config/profile.csh.in +@@ -6,7 +6,7 @@ + + if (! $?DEBUGINFOD_URLS) then + set prefix="@prefix@" +- set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls 2>/dev/null; :' "@sysconfdir@/debuginfod" | tr '\n' ' '` ++ set DEBUGINFOD_URLS=`sh -c 'cat /dev/null "$0"/*.urls 2>/dev/null; :' "@sysconfdir@/debuginfod" | tr '\n' ' '` + if ( "$DEBUGINFOD_URLS" != "" ) then + setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS" + else +diff --git a/config/profile.sh.in b/config/profile.sh.in +index bad20b1e..3f4397dc 100644 +--- a/config/profile.sh.in ++++ b/config/profile.sh.in +@@ -6,7 +6,7 @@ + + if [ -z "$DEBUGINFOD_URLS" ]; then + prefix="@prefix@" +- DEBUGINFOD_URLS=$(cat "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ') ++ DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ') + [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS + unset prefix + fi +-- +2.37.1 +