[applied] abipkgdiff: Emit error when no vmlinux is found in debug package

Message ID 87fsaqrpos.fsf@redhat.com
State New
Headers
Series [applied] abipkgdiff: Emit error when no vmlinux is found in debug package |

Commit Message

Dodji Seketeli Feb. 28, 2023, 11:32 a.m. UTC
  Hello,

When given linux kernel packages to analyze using DWARF, the tool
expects the (uncompressed) vmlinux binary to be found in the debug
info package.

This patch emits an error message when no vmlinux binary is found in
the debug info package in that case.

	* tools/abipkgdiff.cc (compare_prepared_linux_kernel_packages):
	When no vmlinux binary is found in the debug info package, emit an
	error message.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 tools/abipkgdiff.cc | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
  

Patch

diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 8383ae98..a4b4f1a1 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -3107,11 +3107,25 @@  compare_prepared_linux_kernel_packages(package& first_package,
 
   string vmlinux_path1, vmlinux_path2;
 
-  if (!get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
-    return abigail::tools_utils::ABIDIFF_ERROR;
+  if (!vmlinux_path1.empty()
+      && !get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
+    {
+      emit_prefix("abipkgdiff", cerr)
+	<< "Could not find vmlinux in debuginfo package '"
+	<< first_package.path()
+	<< "\n";
+      return abigail::tools_utils::ABIDIFF_ERROR;
+    }
 
-  if (!get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
-    return abigail::tools_utils::ABIDIFF_ERROR;
+  if (!vmlinux_path2.empty()
+      && !get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
+    {
+      emit_prefix("abipkgdiff", cerr)
+	<< "Could not find vmlinux in debuginfo package '"
+	<< second_package.path()
+	<< "\n";
+      return abigail::tools_utils::ABIDIFF_ERROR;
+    }
 
   string dist_root1 = first_package.extracted_dir_path();
   string dist_root2 = second_package.extracted_dir_path();