From d6ddcf6b62a8624e08fe7a239cdd2a1bb04e8039 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Wed, 30 Mar 2022 14:18:43 -0700 Subject: [PATCH] Backport upstream patch for RHBZ 2068280. --- _gdb.spec.Patch.include | 4 + _gdb.spec.patch.include | 1 + _patch_order | 1 + ...z2068280-debuginfod-unavailable-size.patch | 94 +++++++++++++++++++ gdb.spec | 6 +- 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 gdb-rhbz2068280-debuginfod-unavailable-size.patch diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 62e69cb..a007da8 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -359,3 +359,7 @@ Patch086: gdb-rhbz2042257-ftbs-updates.patch # .data section. Patch087: gdb-rhbz2042664-fix-sect_index_data-internal-error +# Backport upstream patch from Aaron Merey which suppresses debuginfod +# progress messages when size is zero. (RH BZ 2068280). +Patch088: gdb-rhbz2068280-debuginfod-unavailable-size.patch + diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 470a7be..b6c1352 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -85,3 +85,4 @@ %patch085 -p1 %patch086 -p1 %patch087 -p1 +%patch088 -p1 diff --git a/_patch_order b/_patch_order index 4d9b861..9a505e7 100644 --- a/_patch_order +++ b/_patch_order @@ -85,3 +85,4 @@ gdb-rhbz202487-rework-set-debuginfod.patch gdb-rhbz2024875-pr27026.patch gdb-rhbz2042257-ftbs-updates.patch gdb-rhbz2042664-fix-sect_index_data-internal-error +gdb-rhbz2068280-debuginfod-unavailable-size.patch diff --git a/gdb-rhbz2068280-debuginfod-unavailable-size.patch b/gdb-rhbz2068280-debuginfod-unavailable-size.patch new file mode 100644 index 0000000..91da0cf --- /dev/null +++ b/gdb-rhbz2068280-debuginfod-unavailable-size.patch @@ -0,0 +1,94 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 30 Mar 2022 13:28:26 -0700 +Subject: gdb-rhbz2068280-debuginfod-unavailable-size.patch + +;; Backport upstream patch from Aaron Merey which suppresses debuginfod +;; progress messages when size is zero. (RH BZ 2068280). + +Remove download size from debuginfod progress messages if unavailable + +Currently debuginfod progress update messages include the size of +each download: + + Downloading 7.5 MB separate debug info for /lib/libxyz.so.0 + +This value originates from the Content-Length HTTP header of the +transfer. However this header is not guaranteed to be present for +each download. This can happen when debuginfod servers compress files +on-the-fly at the time of transfer. In this case gdb wrongly prints +"-0.00 MB" as the size. + +This patch removes download sizes from progress messages when they are +not available. It also removes usage of the progress bar until +a more thorough reworking of progress updating is implemented. [1] + +[1] https://sourceware.org/pipermail/gdb-patches/2022-February/185798.html + +diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c +--- a/gdb/debuginfod-support.c ++++ b/gdb/debuginfod-support.c +@@ -81,12 +81,12 @@ debuginfod_debuginfo_query (const unsigned char *build_id, + struct user_data + { + user_data (const char *desc, const char *fname) +- : desc (desc), fname (fname) ++ : desc (desc), fname (fname), has_printed (false) + { } + + const char * const desc; + const char * const fname; +- gdb::optional meter; ++ bool has_printed; + }; + + /* Deleter for a debuginfod_client. */ +@@ -116,24 +116,32 @@ progressfn (debuginfod_client *c, long cur, long total) + return 1; + } + +- if (total == 0) +- return 0; +- +- if (!data->meter.has_value ()) ++ if (!data->has_printed) + { +- float size_in_mb = 1.0f * total / (1024 * 1024); +- string_file styled_filename (current_uiout->can_emit_style_escape ()); +- fprintf_styled (&styled_filename, +- file_name_style.style (), +- "%s", +- data->fname); +- std::string message +- = string_printf ("Downloading %.2f MB %s %s", size_in_mb, data->desc, +- styled_filename.c_str()); +- data->meter.emplace (current_uiout, message, 1); +- } ++ /* Include the transfer size, if available. */ ++ if (total > 0) ++ { ++ float size = 1.0f * total / 1024; ++ const char *unit = "KB"; ++ ++ /* If size is greater than 0.01 MB, set unit to MB. */ ++ if (size > 10.24) ++ { ++ size /= 1024; ++ unit = "MB"; ++ } ++ ++ printf_filtered ("Downloading %.2f %s %s %ps...\n", ++ size, unit, data->desc, ++ styled_string (file_name_style.style (), ++ data->fname)); ++ } ++ else ++ printf_filtered ("Downloading %s %ps...\n", data->desc, ++ styled_string (file_name_style.style (), data->fname)); + +- current_uiout->progress ((double)cur / (double)total); ++ data->has_printed = true; ++ } + + return 0; + } diff --git a/gdb.spec b/gdb.spec index c2b03fc..3470e0a 100644 --- a/gdb.spec +++ b/gdb.spec @@ -37,7 +37,7 @@ Version: 11.2 # 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. @@ -1147,6 +1147,10 @@ fi %endif %changelog +* Wed Mar 30 2022 Kevin Buettner - 11.2-3 +- Backport upstream patch which removes sizes from debuginfod download + messages when the size is not available (RHBZ 2068280, Aaron Merey). + * Wed Feb 9 2022 Kevin Buettner - 11.2-2 - On ix86, add -Wno-format-overflow to --enable-gdb-build-warnings. (This is a workaround for the bogus warning/error that we now see