diff --git a/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch b/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch new file mode 100644 index 0000000..0ed514a --- /dev/null +++ b/0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch @@ -0,0 +1,33 @@ +From 64d61a5f7d0ed685880f5c4f4b91f967445ba3a9 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 16 Jan 2025 12:02:11 +0100 +Subject: [PATCH] find-debuginfo: Fix skip_mini (".gnu_debugdata") handling + +The conditional that tests $skip_mini for true/false was inadvertently +flipped, causing the add_minidebug() function to no longer run for the +otherwise eligible binary files. + +Fixes: 971a74d79b48 ("find-debuginfo: Check files are writable before modifying them") + +Reported-by: Michal Domonkos +Signed-off-by: Mark Wielaard +--- + scripts/find-debuginfo.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in +index 4e4ef5a64005..f889e6d3b574 100755 +--- a/scripts/find-debuginfo.in ++++ b/scripts/find-debuginfo.in +@@ -550,7 +550,7 @@ do_file() + application/x-executable*) skip_mini=false ;; + application/x-pie-executable*) skip_mini=false ;; + esac +- if test "$skip_mini" = "true"; then ++ if test "$skip_mini" = "false"; then + if test "$f_writable" = "false"; then + chmod u+w "$f" + fi +-- +2.47.1 + diff --git a/0001-find-debuginfo-Make-return-from-do_file-explicit.patch b/0001-find-debuginfo-Make-return-from-do_file-explicit.patch new file mode 100644 index 0000000..ac54f90 --- /dev/null +++ b/0001-find-debuginfo-Make-return-from-do_file-explicit.patch @@ -0,0 +1,68 @@ +From 1869e3b886c4596fb4ce471dd08121401d207cfa Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 16 Jan 2025 19:09:00 +0100 +Subject: [PATCH] find-debuginfo: Make return from do_file explicit + +Make all returns from do_file explicit so they don't implicitly return +the result of the last command. Also make sure the $temp/linked file +exists, even if it is empty. A file could have hardlinks to files not +under the buildroot. + +https://bugzilla.redhat.com/show_bug.cgi?id=2334760 + +Signed-off-by: Mark Wielaard +--- + scripts/find-debuginfo.in | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in +index a360bf0582dc..d102e8937775 100755 +--- a/scripts/find-debuginfo.in ++++ b/scripts/find-debuginfo.in +@@ -434,6 +434,7 @@ trap 'rm -rf "$temp"' EXIT + + # Build a list of unstripped ELF files and their hardlinks + touch "$temp/primary" ++touch "$temp/linked" + find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \ + \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \ + -print | LC_ALL=C sort | +@@ -458,7 +459,7 @@ do_file() + local nlinks=$1 inum=$2 f=$3 id link linked + + get_debugfn "$f" +- [ -f "${debugfn}" ] && return ++ [ -f "${debugfn}" ] && return 0 + + $verbose && echo "extracting debug info from $f" + # See also cpio SOURCEFILE copy. Directories must match up. +@@ -475,7 +476,7 @@ do_file() + id=$(debugedit -b "$debug_base_name" -d "$debug_dest_name" \ + $no_recompute -i \ + ${build_id_seed:+--build-id-seed="$build_id_seed"} \ +- -l "$SOURCEFILE" "$f") || exit ++ -l "$SOURCEFILE" "$f") || return 1 + if [ -z "$id" ]; then + echo >&2 "*** ${strict_error}: No build ID note found in $f" + $strict && return 2 +@@ -503,7 +504,7 @@ do_file() + # just has its file names collected and adjusted. + case "$dn" in + /usr/lib/debug/*) +- return ;; ++ return 0 ;; + esac + + mkdir -p "${debugdn}" +@@ -544,6 +545,8 @@ do_file() + mkdir -p "$(dirname "$debugfn")" && ln -nf "$link" "$debugfn" + done + fi ++ ++ return 0 + } + + # 16^6 - 1 or about 16 million files +-- +2.47.1 + diff --git a/debugedit.spec b/debugedit.spec index 79643b2..006ca54 100644 --- a/debugedit.spec +++ b/debugedit.spec @@ -1,6 +1,6 @@ Name: debugedit Version: 5.1 -Release: 2%{?dist} +Release: 4%{?dist} Summary: Tools and scripts for creating debuginfo and source file distributions, collect build-ids and rewrite source paths in DWARF data for debugging, tracing and profiling. License: GPL-3.0-or-later AND GPL-2.0-or-later AND LGPL-2.0-or-later URL: https://sourceware.org/debugedit/ @@ -19,6 +19,8 @@ BuildRequires: dwz # For debugedit build-id recomputation BuildRequires: xxhash-devel +# debugedit builds with XXH_INLINE_ALL, so depend on (virtual) xxhash-static +BuildRequires: xxhash-static # For the testsuite. BuildRequires: autoconf @@ -45,6 +47,8 @@ Requires: grep %global _hardened_build 1 Patch1: 0001-find-debuginfo-Check-files-are-writable-before-modif.patch +Patch2: 0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch +patch3: 0001-find-debuginfo-Make-return-from-do_file-explicit.patch %description The debugedit project provides programs and scripts for creating @@ -86,6 +90,12 @@ make check %{?_smp_mflags} %{_mandir}/man1/find-debuginfo.1* %changelog +* Thu Jan 16 2025 Mark Wielaard - 5.1-4 +- Add 0001-find-debuginfo-Make-return-from-do_file-explicit.patch + +* Thu Jan 16 2025 Mark Wielaard - 5.1-3 +- Add 0001-find-debuginfo-Fix-skip_mini-.gnu_debugdata-handling.patch + * Thu Nov 28 2024 Mark Wielaard - 5.1-2 - Add 0001-find-debuginfo-Check-files-are-writable-before-modif.patch