[applied] rhbz2355363 - abipkgdiff: Don't abort when alternate debug info is not found

Message ID 87bjt8xitl.fsf@redhat.com
State New
Headers
Series [applied] rhbz2355363 - abipkgdiff: Don't abort when alternate debug info is not found |

Commit Message

Dodji Seketeli April 7, 2025, 12:22 p.m. UTC
  Hello,

When the alternate debug info is not found *and* no debug info package
has been provided, abipkgdiff aborts.  Oops.

This patch fixes that.

	* tools/abipkgdiff.cc (emit_alt_debug_info_not_found_error): Avoid
	asserting here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to mainline.
---
 tools/abipkgdiff.cc | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
  

Patch

diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 5193f7c4..7380082d 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -1442,20 +1442,25 @@  emit_alt_debug_info_not_found_error(abigail::elf_based_reader&	reader,
 				    ostream&			out,
 				    bool			is_old_package)
 {
-  ABG_ASSERT(is_old_package
-	     ? !opts.debug_packages1.empty()
-	     : !opts.debug_packages2.empty());
+  string fname;
+  tools_utils::base_name(elf_file.path, fname);
+
+  const vector<string>& debug_pkgs_list =
+    is_old_package
+    ? opts.debug_packages1
+    : opts.debug_packages2;
+
+  if (debug_pkgs_list.empty())
+    emit_prefix("abipkgdiff", out)
+      << "Could not find alternate debug info found for file '" << fname << "'"
+      << "Maybe look into properly setting up debuginfod service "
+      << "to fetch debug info?\n";
 
-  string filename;
-  tools_utils::base_name(elf_file.path, filename);
   emit_prefix("abipkgdiff", out)
-    << "While reading elf file '"
-    << filename
-    << "', could not find alternate debug info in provided "
-    "debug info package(s) "
-    << get_pretty_printed_list_of_packages(is_old_package
-					   ? opts.debug_packages1
-					   : opts.debug_packages2)
+    << "While reading elf file '" << fname << "'"
+    << ", could not find alternate debug info in provided "
+    << "debug info package(s) "
+    << get_pretty_printed_list_of_packages(debug_pkgs_list)
     << "\n";
 
   string alt_di_path;