Fix 'Recursive call to 'missing_rpm_list_print' when pagination is

on and missing RPM list is big' (RHBZ 1801974, Sergio Durigan
  Junior).
This commit is contained in:
Sergio Durigan Junior 2020-02-13 14:21:00 -05:00
parent cd3e3d1a80
commit 76de449876
2 changed files with 27 additions and 7 deletions

View File

@ -243,7 +243,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
#include "libbfd.h"
#include "objfiles.h"
#include "observable.h"
@@ -698,8 +699,359 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
@@ -698,8 +699,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return)
return result;
}
@ -541,6 +541,22 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+
+ std::sort (array.begin (), array.end (), missing_rpm_list_compar);
+
+ /* We zero out the number of missing RPMs here because of a nasty
+ bug (see RHBZ 1801974).
+
+ When we call 'puts_unfiltered' below, if pagination is on and if
+ the number of missing RPMs is big enough to trigger pagination,
+ we will end up in an infinite recursion. The call chain looks
+ like this:
+
+ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered
+ -> prompt_for_continue -> display_gdb_prompt ->
+ debug_flush_missing -> missing_rpm_list_print ...
+
+ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero
+ *before* calling any print function. */
+ missing_rpm_list_entries = 0;
+
+ printf_unfiltered (_("Missing separate debuginfos, use: %s"),
+#ifdef DNF_DEBUGINFO_INSTALL
+ "dnf "
@ -548,10 +564,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ "debuginfo-install");
+ for (const char *el : array)
+ {
+ putchar_unfiltered (' ');
+ puts_unfiltered (" ");
+ puts_unfiltered (el);
+ }
+ putchar_unfiltered ('\n');
+ puts_unfiltered ("\n");
+
+ while (missing_rpm_list != NULL)
+ {
@ -559,7 +575,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
+ missing_rpm_list = list_iter->next;
+ xfree (list_iter);
+ }
+ missing_rpm_list_entries = 0;
+}
+
+static void
@ -604,7 +619,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
avoidance. */
struct missing_filepair
@@ -753,11 +1105,17 @@ missing_filepair_change (void)
@@ -753,11 +1120,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -622,7 +637,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c
missing_filepair_change ();
}
@@ -824,14 +1182,38 @@ debug_print_missing (const char *binary, const char *debug)
@@ -824,14 +1197,38 @@ debug_print_missing (const char *binary, const char *debug)
*slot = missing_filepair;

View File

@ -35,7 +35,7 @@ Version: 9.1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -1154,6 +1154,11 @@ fi
%endif
%changelog
* Thu Feb 13 2020 Sergio Durigan Junior <sergiodj@redhat.com> - 9.1-3
- Fix 'Recursive call to 'missing_rpm_list_print' when pagination is
on and missing RPM list is big' (RHBZ 1801974, Sergio Durigan
Junior).
* Mon Feb 10 2020 Sergio Durigan Junior <sergiodj@redhat.com> - 9.1-2
- Enable libxxhash during build.