From 8e4cc451ef0bfb06b6edfe95041de0fb1cc43e44 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Wed, 8 Mar 2023 13:21:19 +0100 Subject: [PATCH 1/9] CI Tests: Fix the debuginfod URL --- .../Makefile | 2 +- .../main.fmf | 10 +++--- .../runtest.sh | 35 +++++++++++++++---- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/tests/Regression/GNU-Attribute-notes-not-recognized/Makefile b/tests/Regression/GNU-Attribute-notes-not-recognized/Makefile index 03e071d..332e11f 100644 --- a/tests/Regression/GNU-Attribute-notes-not-recognized/Makefile +++ b/tests/Regression/GNU-Attribute-notes-not-recognized/Makefile @@ -54,7 +54,7 @@ $(METADATA): Makefile @echo "TestTime: 48h" >> $(METADATA) @echo "RunFor: elfutils" >> $(METADATA) @echo "Requires: elfutils" >> $(METADATA) - @echo "Requires: bash" >> $(METADATA) + @echo "Requires: bash bash-debuginfo" >> $(METADATA) @echo "Priority: Normal" >> $(METADATA) @echo "License: GPLv2+" >> $(METADATA) @echo "Confidential: no" >> $(METADATA) diff --git a/tests/Regression/GNU-Attribute-notes-not-recognized/main.fmf b/tests/Regression/GNU-Attribute-notes-not-recognized/main.fmf index 896cbd2..eb1809c 100644 --- a/tests/Regression/GNU-Attribute-notes-not-recognized/main.fmf +++ b/tests/Regression/GNU-Attribute-notes-not-recognized/main.fmf @@ -2,15 +2,15 @@ summary: GNU-Attribute-notes-not-recognized description: | Bug summary: elfutils doesn't recognize GNU Attribute notes Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1650125 -contact: -- Martin Cermak +contact: Martin Cermak component: -- elfutils + - elfutils test: ./runtest.sh framework: beakerlib recommend: -- elfutils -- bash + - elfutils + - bash + - bash-debuginfo duration: 48h extra-summary: /tools/elfutils/Regression/GNU-Attribute-notes-not-recognized extra-task: /tools/elfutils/Regression/GNU-Attribute-notes-not-recognized diff --git a/tests/Regression/GNU-Attribute-notes-not-recognized/runtest.sh b/tests/Regression/GNU-Attribute-notes-not-recognized/runtest.sh index d60f5ac..aaa6c89 100755 --- a/tests/Regression/GNU-Attribute-notes-not-recognized/runtest.sh +++ b/tests/Regression/GNU-Attribute-notes-not-recognized/runtest.sh @@ -32,12 +32,35 @@ PACKAGE="elfutils" rlJournalStart rlPhaseStartTest - # Rely on that /bin/bash is annobin-annotated per - # - https://fedoraproject.org/wiki/Toolchain/Watermark - # - https://fedoraproject.org/wiki/Changes/Annobin - # Seems to work fine with bash-4.4.19-6.el8 and elfutils-0.174-5.el8. - set -o pipefail - rlRun "eu-readelf -n /bin/bash | grep -2 '^ GA' | fgrep 'GNU Build Attribute' | tail -50" + # Rely on that /bin/bash is annobin-annotated per + # - https://fedoraproject.org/wiki/Toolchain/Watermark + # - https://fedoraproject.org/wiki/Changes/Annobin + # Seems to work fine with bash-4.4.19-6.el8 and elfutils-0.174-5.el8. + f="/bin/bash" + + # Annobin notes originally used to reside in the binary itself. + # Later on they moved to debuginfo. + # Let's see if we can chase down needed debuginfo somewhere... + + # Attempt getting the needed file using debuginfod + export DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ + rlRun "f=\"$f $(debuginfod-find debuginfo /bin/bash)\"" + + # Attempt getting the needed file by traditional means + rlRun "debuginfo-install -y bash" + rlRun "buildid=$(eu-readelf -n /bin/bash | awk '/Build ID:/ {print $NF}')" + for i in $(rpm -ql bash-debuginfo); do + test -f $i || continue + if eu-readelf -n $i | fgrep $buildid; then + rlRun "f=\"$f $i\"" + fi + done + + set -o pipefail + export f + # Check if eu-readelf can read the notes from at least one of files + # that can possibly contain it... + rlRun "(for i in $f; do eu-readelf -n $i; done ) | grep -2 '^ GA' | fgrep 'GNU Build Attribute' | tail -50" rlPhaseEnd rlJournalPrintText rlJournalEnd From e6d64221a41307a9fa5e0f765dda1faaee4eed1d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 02:12:19 +0000 Subject: [PATCH 2/9] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- elfutils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elfutils.spec b/elfutils.spec index 3d372ad..997c470 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils Version: 0.188 -%global baserelease 3 +%global baserelease 4 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -448,6 +448,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 0.188-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Mon Nov 7 2022 Mark Wielaard - 0.188-3 - Add elfutils-0.188-compile-warnings.patch - Add elfutils-0.188-debuginfod-client-lifetime.patch From 1981265e9502917b9092b84c2381d2f9d673537c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 27 Jan 2023 19:09:16 +0100 Subject: [PATCH 3/9] 0.188-5 Add various libcurl fixes for deprecated constants - Add elfutils-0.188-deprecated-CURLINFO.patch, elfutils-0.188-CURL_AT_LEAST_VERSION.patch and elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch --- elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch | 35 ++++++++++++++++ elfutils-0.188-CURL_AT_LEAST_VERSION.patch | 36 ++++++++++++++++ elfutils-0.188-deprecated-CURLINFO.patch | 49 ++++++++++++++++++++++ elfutils.spec | 11 ++++- 4 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch create mode 100644 elfutils-0.188-CURL_AT_LEAST_VERSION.patch create mode 100644 elfutils-0.188-deprecated-CURLINFO.patch diff --git a/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch b/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch new file mode 100644 index 0000000..3352c21 --- /dev/null +++ b/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch @@ -0,0 +1,35 @@ +From 6560fb26a62ef135a804357ef4f15a47de3e49b3 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Tue, 10 Jan 2023 23:20:41 +0100 +Subject: [PATCH 8/8] debuginfod-client: Use CURLOPT_PROTOCOLS_STR for libcurl + >= 7.85.0 + +https://sourceware.org/bugzilla/show_bug.cgi?id=29926 + +Signed-off-by: Mark Wielaard +--- + debuginfod/ChangeLog | 5 +++++ + debuginfod/debuginfod-client.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index a16165bd..1ce45632 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -1336,8 +1336,13 @@ debuginfod_query_server (debuginfod_client *c, + + /* Only allow http:// + https:// + file:// so we aren't being + redirected to some unsupported protocol. */ ++#if CURL_AT_LEAST_VERSION(7, 85, 0) ++ curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR, ++ "http,https,file"); ++#else + curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS, + (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE)); ++#endif + curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url); + if (vfd >= 0) + curl_easy_setopt_ck(data[i].handle, CURLOPT_ERRORBUFFER, +-- +2.39.1 + diff --git a/elfutils-0.188-CURL_AT_LEAST_VERSION.patch b/elfutils-0.188-CURL_AT_LEAST_VERSION.patch new file mode 100644 index 0000000..0eca664 --- /dev/null +++ b/elfutils-0.188-CURL_AT_LEAST_VERSION.patch @@ -0,0 +1,36 @@ +From 304741e11018c29e7ff17751e05dcc5c786a3fd9 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 21 Dec 2022 18:21:08 +0100 +Subject: [PATCH 2/8] debuginfod: Define CURL_AT_LEAST_VERSION if necessary + +Older curl.h don't define CURL_AT_LEAST_VERSION, so define it +ourselves because it is nicer than doing hex encoded version +comparisons. + +Signed-off-by: Mark Wielaard +--- + debuginfod/ChangeLog | 4 ++++ + debuginfod/debuginfod-client.c | 7 +++++++ + 2 files changed, 11 insertions(+) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index 692aecce..a16165bd 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -105,6 +105,13 @@ void debuginfod_end (debuginfod_client *c) { } + #include + #endif + ++/* Older curl.h don't define CURL_AT_LEAST_VERSION. */ ++#ifndef CURL_AT_LEAST_VERSION ++ #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) ++ #define CURL_AT_LEAST_VERSION(x,y,z) \ ++ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) ++#endif ++ + #include + + static pthread_once_t init_control = PTHREAD_ONCE_INIT; +-- +2.39.1 + diff --git a/elfutils-0.188-deprecated-CURLINFO.patch b/elfutils-0.188-deprecated-CURLINFO.patch new file mode 100644 index 0000000..e9bc9a3 --- /dev/null +++ b/elfutils-0.188-deprecated-CURLINFO.patch @@ -0,0 +1,49 @@ +From d2bf497b12fbd49b4996ccf0744303ffd67735b1 Mon Sep 17 00:00:00 2001 +From: Andrew Paprocki +Date: Wed, 21 Dec 2022 11:15:00 -0500 +Subject: [PATCH 1/8] PR29926: debuginfod: Fix usage of deprecated CURLINFO_* + +The `CURLINFO_SIZE_DOWNLOAD_T` and `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T` +identifiers are `enum`s, not pre-processor definitions, so the current +`#ifdef` logic is not selecting the newer API. This results in the +older identifiers being used and they now generate errors when compiled +against Curl 7.87, which has silently deprecated them, causing GCC to +emit `-Werror=deprecated-declarations`. + +Instead, the newer identifiers were added in Curl 7.55, so explicitly +check for `CURL_AT_LEAST_VERSION(7, 55, 0)` instead of the current +logic. This eliminates the error when compiling against Curl 7.87. + +Ref: https://github.com/curl/curl/pull/1511 + +Signed-off-by: Andrew Paprocki +--- + debuginfod/ChangeLog | 4 ++++ + debuginfod/debuginfod-client.c | 4 ++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c +index 8873fcc8..692aecce 100644 +--- a/debuginfod/debuginfod-client.c ++++ b/debuginfod/debuginfod-client.c +@@ -1456,7 +1456,7 @@ debuginfod_query_server (debuginfod_client *c, + deflate-compressing proxies, this number is likely to be + unavailable, so -1 may show. */ + CURLcode curl_res; +-#ifdef CURLINFO_CONTENT_LENGTH_DOWNLOAD_T ++#if CURL_AT_LEAST_VERSION(7, 55, 0) + curl_off_t cl; + curl_res = curl_easy_getinfo(target_handle, + CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, +@@ -1491,7 +1491,7 @@ debuginfod_query_server (debuginfod_client *c, + if (target_handle) /* we've committed to a server; report its download progress */ + { + CURLcode curl_res; +-#ifdef CURLINFO_SIZE_DOWNLOAD_T ++#if CURL_AT_LEAST_VERSION(7, 55, 0) + curl_off_t dl; + curl_res = curl_easy_getinfo(target_handle, + CURLINFO_SIZE_DOWNLOAD_T, +-- +2.39.1 + diff --git a/elfutils.spec b/elfutils.spec index 997c470..849868f 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils Version: 0.188 -%global baserelease 4 +%global baserelease 5 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -80,6 +80,10 @@ Patch2: elfutils-0.188-static-extract_section.patch Patch3: elfutils-0.188-compile-warnings.patch # The debuginfod_client object lifetime needs more careful handling Patch4: elfutils-0.188-debuginfod-client-lifetime.patch +# Various libcurl deprecated constants +Patch5: elfutils-0.188-deprecated-CURLINFO.patch +Patch6: elfutils-0.188-CURL_AT_LEAST_VERSION.patch +Patch7: elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch %description Elfutils is a collection of utilities, including stack (to show @@ -448,6 +452,11 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Fri Jan 27 2023 Mark Wielaard - 0.188-5 +- Add elfutils-0.188-deprecated-CURLINFO.patch, + elfutils-0.188-CURL_AT_LEAST_VERSION.patch and + elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch + * Thu Jan 19 2023 Fedora Release Engineering - 0.188-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From c56264d5660e48459ce50c7503eb5881139a8a52 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 3 Mar 2023 17:44:51 +0100 Subject: [PATCH 4/9] 0.189-1 - Upgrade to upsteam elfutils 0.189 --- .gitignore | 1 + elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch | 35 ---- elfutils-0.188-CURL_AT_LEAST_VERSION.patch | 36 ---- elfutils-0.188-compile-warnings.patch | 109 ----------- ...ils-0.188-debuginfod-client-lifetime.patch | 171 ------------------ elfutils-0.188-deprecated-CURLINFO.patch | 49 ----- elfutils-0.188-static-extract_section.patch | 24 --- elfutils.spec | 17 +- sources | 2 +- 9 files changed, 7 insertions(+), 437 deletions(-) delete mode 100644 elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch delete mode 100644 elfutils-0.188-CURL_AT_LEAST_VERSION.patch delete mode 100644 elfutils-0.188-compile-warnings.patch delete mode 100644 elfutils-0.188-debuginfod-client-lifetime.patch delete mode 100644 elfutils-0.188-deprecated-CURLINFO.patch delete mode 100644 elfutils-0.188-static-extract_section.patch diff --git a/.gitignore b/.gitignore index d23f6fd..9d73fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ /elfutils-0.186.tar.bz2 /elfutils-0.187.tar.bz2 /elfutils-0.188.tar.bz2 +/elfutils-0.189.tar.bz2 diff --git a/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch b/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch deleted file mode 100644 index 3352c21..0000000 --- a/elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 6560fb26a62ef135a804357ef4f15a47de3e49b3 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Tue, 10 Jan 2023 23:20:41 +0100 -Subject: [PATCH 8/8] debuginfod-client: Use CURLOPT_PROTOCOLS_STR for libcurl - >= 7.85.0 - -https://sourceware.org/bugzilla/show_bug.cgi?id=29926 - -Signed-off-by: Mark Wielaard ---- - debuginfod/ChangeLog | 5 +++++ - debuginfod/debuginfod-client.c | 5 +++++ - 2 files changed, 10 insertions(+) - -diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c -index a16165bd..1ce45632 100644 ---- a/debuginfod/debuginfod-client.c -+++ b/debuginfod/debuginfod-client.c -@@ -1336,8 +1336,13 @@ debuginfod_query_server (debuginfod_client *c, - - /* Only allow http:// + https:// + file:// so we aren't being - redirected to some unsupported protocol. */ -+#if CURL_AT_LEAST_VERSION(7, 85, 0) -+ curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR, -+ "http,https,file"); -+#else - curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS, - (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE)); -+#endif - curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url); - if (vfd >= 0) - curl_easy_setopt_ck(data[i].handle, CURLOPT_ERRORBUFFER, --- -2.39.1 - diff --git a/elfutils-0.188-CURL_AT_LEAST_VERSION.patch b/elfutils-0.188-CURL_AT_LEAST_VERSION.patch deleted file mode 100644 index 0eca664..0000000 --- a/elfutils-0.188-CURL_AT_LEAST_VERSION.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 304741e11018c29e7ff17751e05dcc5c786a3fd9 Mon Sep 17 00:00:00 2001 -From: Mark Wielaard -Date: Wed, 21 Dec 2022 18:21:08 +0100 -Subject: [PATCH 2/8] debuginfod: Define CURL_AT_LEAST_VERSION if necessary - -Older curl.h don't define CURL_AT_LEAST_VERSION, so define it -ourselves because it is nicer than doing hex encoded version -comparisons. - -Signed-off-by: Mark Wielaard ---- - debuginfod/ChangeLog | 4 ++++ - debuginfod/debuginfod-client.c | 7 +++++++ - 2 files changed, 11 insertions(+) - -diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c -index 692aecce..a16165bd 100644 ---- a/debuginfod/debuginfod-client.c -+++ b/debuginfod/debuginfod-client.c -@@ -105,6 +105,13 @@ void debuginfod_end (debuginfod_client *c) { } - #include - #endif - -+/* Older curl.h don't define CURL_AT_LEAST_VERSION. */ -+#ifndef CURL_AT_LEAST_VERSION -+ #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z)) -+ #define CURL_AT_LEAST_VERSION(x,y,z) \ -+ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) -+#endif -+ - #include - - static pthread_once_t init_control = PTHREAD_ONCE_INIT; --- -2.39.1 - diff --git a/elfutils-0.188-compile-warnings.patch b/elfutils-0.188-compile-warnings.patch deleted file mode 100644 index 397583f..0000000 --- a/elfutils-0.188-compile-warnings.patch +++ /dev/null @@ -1,109 +0,0 @@ -commit 75f2de448f311807e2493f2a37a980e2d872b229 -Author: Mark Wielaard -Date: Thu Nov 3 13:38:45 2022 +0100 - - readelf: Check phdr != NULL or shdr != NULL in handle_dynamic. - - The compiler doesn't know that when use_dynamic_segment is true, - then phdr should/will be non-NULL and otherwise shdr is non-NULL. - Add explicit checks to help the compiler out and in case an error - is made calling the handle_dynamic function. - - Signed-off-by: Mark Wielaard - -diff --git a/src/readelf.c b/src/readelf.c -index 0e0b05c4..e721a209 100644 ---- a/src/readelf.c -+++ b/src/readelf.c -@@ -1828,7 +1828,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) - size_t dyn_ents; - - /* Get the data of the section. */ -- if (use_dynamic_segment) -+ if (use_dynamic_segment && phdr != NULL) - data = elf_getdata_rawchunk(ebl->elf, phdr->p_offset, - phdr->p_filesz, ELF_T_DYN); - else -@@ -1840,7 +1840,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) - /* Get the dynamic section entry number */ - dyn_ents = get_dyn_ents (data); - -- if (!use_dynamic_segment) -+ if (!use_dynamic_segment && shdr != NULL) - { - /* Get the section header string table index. */ - if (unlikely (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)) -@@ -1862,7 +1862,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) - (int) shdr->sh_link, - elf_strptr (ebl->elf, shstrndx, glink->sh_name)); - } -- else -+ else if (phdr != NULL) - { - printf (ngettext ("\ - \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 "\n", -@@ -1879,7 +1879,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) - /* if --use-dynamic option is enabled, - use the string table to get the related library info. */ - Elf_Data *strtab_data = NULL; -- if (use_dynamic_segment) -+ if (use_dynamic_segment && phdr != NULL) - { - strtab_data = get_dynscn_strtab(ebl->elf, phdr); - if (strtab_data == NULL) -@@ -1903,7 +1903,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr, GElf_Phdr *phdr) - || dyn->d_tag == DT_RPATH - || dyn->d_tag == DT_RUNPATH) - { -- if (! use_dynamic_segment) -+ if (! use_dynamic_segment && shdr != NULL) - name = elf_strptr (ebl->elf, shdr->sh_link, dyn->d_un.d_val); - else if (dyn->d_un.d_val < strtab_data->d_size - && memrchr (strtab_data->d_buf + dyn->d_un.d_val, '\0', - -commit b0a0235771906e3bcd6174c4e3c020b5522b0be5 -Author: Mark Wielaard -Date: Thu Nov 3 13:44:35 2022 +0100 - - libdw: Don't dereference and assign values we are skipping - - We don't use the FDE address encoding byte, so no reason - to read and store it. Just skip past it. - - Signed-off-by: Mark Wielaard - -diff --git a/libdw/dwarf_next_cfi.c b/libdw/dwarf_next_cfi.c -index 23b16885..be08984f 100644 ---- a/libdw/dwarf_next_cfi.c -+++ b/libdw/dwarf_next_cfi.c -@@ -226,7 +226,7 @@ dwarf_next_cfi (const unsigned char e_ident[], - if (sized_augmentation) - { - /* Skip FDE address encoding byte. */ -- encoding = *bytes++; -+ bytes++; - continue; - } - break; - -commit 52a6a3110e019d696284fdd822c2a2f0987dded2 -Author: Mark Wielaard -Date: Thu Nov 3 13:52:32 2022 +0100 - - readelf: Check gelf_getdyn doesn't return NULL - - Signed-off-by: Mark Wielaard - -diff --git a/src/readelf.c b/src/readelf.c -index e721a209..3dafb041 100644 ---- a/src/readelf.c -+++ b/src/readelf.c -@@ -4910,7 +4910,7 @@ get_dynscn_addrs(Elf *elf, GElf_Phdr *phdr, GElf_Addr addrs[i_max]) - GElf_Dyn dyn_mem; - GElf_Dyn *dyn = gelf_getdyn(data, dyn_idx, &dyn_mem); - /* DT_NULL Marks end of dynamic section. */ -- if (dyn->d_tag == DT_NULL) -+ if (dyn == NULL || dyn->d_tag == DT_NULL) - break; - - switch (dyn->d_tag) { diff --git a/elfutils-0.188-debuginfod-client-lifetime.patch b/elfutils-0.188-debuginfod-client-lifetime.patch deleted file mode 100644 index 4c8f735..0000000 --- a/elfutils-0.188-debuginfod-client-lifetime.patch +++ /dev/null @@ -1,171 +0,0 @@ -commit c424e5f3d24f76e01242d15ba361dc6234706fed -Author: Frank Ch. Eigler -Date: Thu Nov 3 10:07:31 2022 -0400 - - debuginfod.cxx: fix coverity-found use-after-release error - - The debuginfod_client object lifetime needs more careful handling, - made easier with the defer_dtor<> gadget. - - Signed-off-by: Frank Ch. Eigler - -diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx -index f46da6ef..02a11477 100644 ---- a/debuginfod/debuginfod.cxx -+++ b/debuginfod/debuginfod.cxx -@@ -2249,85 +2249,82 @@ handle_buildid (MHD_Connection* conn, - - int fd = -1; - debuginfod_client *client = debuginfod_pool_begin (); -- if (client != NULL) -- { -- debuginfod_set_progressfn (client, & debuginfod_find_progress); -+ if (client == NULL) -+ throw libc_exception(errno, "debuginfod client pool alloc"); -+ defer_dtor client_closer (client, debuginfod_pool_end); -+ -+ debuginfod_set_progressfn (client, & debuginfod_find_progress); - -- if (conn) -- { -- // Transcribe incoming User-Agent: -- string ua = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "User-Agent") ?: ""; -- string ua_complete = string("User-Agent: ") + ua; -- debuginfod_add_http_header (client, ua_complete.c_str()); -- -- // Compute larger XFF:, for avoiding info loss during -- // federation, and for future cyclicity detection. -- string xff = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "X-Forwarded-For") ?: ""; -- if (xff != "") -- xff += string(", "); // comma separated list -- -- unsigned int xff_count = 0; -- for (auto&& i : xff){ -- if (i == ',') xff_count++; -- } -+ if (conn) -+ { -+ // Transcribe incoming User-Agent: -+ string ua = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "User-Agent") ?: ""; -+ string ua_complete = string("User-Agent: ") + ua; -+ debuginfod_add_http_header (client, ua_complete.c_str()); -+ -+ // Compute larger XFF:, for avoiding info loss during -+ // federation, and for future cyclicity detection. -+ string xff = MHD_lookup_connection_value (conn, MHD_HEADER_KIND, "X-Forwarded-For") ?: ""; -+ if (xff != "") -+ xff += string(", "); // comma separated list -+ -+ unsigned int xff_count = 0; -+ for (auto&& i : xff){ -+ if (i == ',') xff_count++; -+ } - -- // if X-Forwarded-For: exceeds N hops, -- // do not delegate a local lookup miss to upstream debuginfods. -- if (xff_count >= forwarded_ttl_limit) -- throw reportable_exception(MHD_HTTP_NOT_FOUND, "not found, --forwared-ttl-limit reached \ -+ // if X-Forwarded-For: exceeds N hops, -+ // do not delegate a local lookup miss to upstream debuginfods. -+ if (xff_count >= forwarded_ttl_limit) -+ throw reportable_exception(MHD_HTTP_NOT_FOUND, "not found, --forwared-ttl-limit reached \ - and will not query the upstream servers"); - -- // Compute the client's numeric IP address only - so can't merge with conninfo() -- const union MHD_ConnectionInfo *u = MHD_get_connection_info (conn, -- MHD_CONNECTION_INFO_CLIENT_ADDRESS); -- struct sockaddr *so = u ? u->client_addr : 0; -- char hostname[256] = ""; // RFC1035 -- if (so && so->sa_family == AF_INET) { -- (void) getnameinfo (so, sizeof (struct sockaddr_in), hostname, sizeof (hostname), NULL, 0, -- NI_NUMERICHOST); -- } else if (so && so->sa_family == AF_INET6) { -- struct sockaddr_in6* addr6 = (struct sockaddr_in6*) so; -- if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) { -- struct sockaddr_in addr4; -- memset (&addr4, 0, sizeof(addr4)); -- addr4.sin_family = AF_INET; -- addr4.sin_port = addr6->sin6_port; -- memcpy (&addr4.sin_addr.s_addr, addr6->sin6_addr.s6_addr+12, sizeof(addr4.sin_addr.s_addr)); -- (void) getnameinfo ((struct sockaddr*) &addr4, sizeof (addr4), -- hostname, sizeof (hostname), NULL, 0, -- NI_NUMERICHOST); -- } else { -- (void) getnameinfo (so, sizeof (struct sockaddr_in6), hostname, sizeof (hostname), NULL, 0, -- NI_NUMERICHOST); -- } -- } -- -- string xff_complete = string("X-Forwarded-For: ")+xff+string(hostname); -- debuginfod_add_http_header (client, xff_complete.c_str()); -+ // Compute the client's numeric IP address only - so can't merge with conninfo() -+ const union MHD_ConnectionInfo *u = MHD_get_connection_info (conn, -+ MHD_CONNECTION_INFO_CLIENT_ADDRESS); -+ struct sockaddr *so = u ? u->client_addr : 0; -+ char hostname[256] = ""; // RFC1035 -+ if (so && so->sa_family == AF_INET) { -+ (void) getnameinfo (so, sizeof (struct sockaddr_in), hostname, sizeof (hostname), NULL, 0, -+ NI_NUMERICHOST); -+ } else if (so && so->sa_family == AF_INET6) { -+ struct sockaddr_in6* addr6 = (struct sockaddr_in6*) so; -+ if (IN6_IS_ADDR_V4MAPPED(&addr6->sin6_addr)) { -+ struct sockaddr_in addr4; -+ memset (&addr4, 0, sizeof(addr4)); -+ addr4.sin_family = AF_INET; -+ addr4.sin_port = addr6->sin6_port; -+ memcpy (&addr4.sin_addr.s_addr, addr6->sin6_addr.s6_addr+12, sizeof(addr4.sin_addr.s_addr)); -+ (void) getnameinfo ((struct sockaddr*) &addr4, sizeof (addr4), -+ hostname, sizeof (hostname), NULL, 0, -+ NI_NUMERICHOST); -+ } else { -+ (void) getnameinfo (so, sizeof (struct sockaddr_in6), hostname, sizeof (hostname), NULL, 0, -+ NI_NUMERICHOST); - } -- -- if (artifacttype == "debuginfo") -- fd = debuginfod_find_debuginfo (client, -- (const unsigned char*) buildid.c_str(), -- 0, NULL); -- else if (artifacttype == "executable") -- fd = debuginfod_find_executable (client, -- (const unsigned char*) buildid.c_str(), -- 0, NULL); -- else if (artifacttype == "source") -- fd = debuginfod_find_source (client, -- (const unsigned char*) buildid.c_str(), -- 0, suffix.c_str(), NULL); -- else if (artifacttype == "section") -- fd = debuginfod_find_section (client, -- (const unsigned char*) buildid.c_str(), -- 0, section.c_str(), NULL); -- -+ } -+ -+ string xff_complete = string("X-Forwarded-For: ")+xff+string(hostname); -+ debuginfod_add_http_header (client, xff_complete.c_str()); - } -- else -- fd = -errno; /* Set by debuginfod_begin. */ -- debuginfod_pool_end (client); -- -+ -+ if (artifacttype == "debuginfo") -+ fd = debuginfod_find_debuginfo (client, -+ (const unsigned char*) buildid.c_str(), -+ 0, NULL); -+ else if (artifacttype == "executable") -+ fd = debuginfod_find_executable (client, -+ (const unsigned char*) buildid.c_str(), -+ 0, NULL); -+ else if (artifacttype == "source") -+ fd = debuginfod_find_source (client, -+ (const unsigned char*) buildid.c_str(), -+ 0, suffix.c_str(), NULL); -+ else if (artifacttype == "section") -+ fd = debuginfod_find_section (client, -+ (const unsigned char*) buildid.c_str(), -+ 0, section.c_str(), NULL); -+ - if (fd >= 0) - { - if (conn != 0) diff --git a/elfutils-0.188-deprecated-CURLINFO.patch b/elfutils-0.188-deprecated-CURLINFO.patch deleted file mode 100644 index e9bc9a3..0000000 --- a/elfutils-0.188-deprecated-CURLINFO.patch +++ /dev/null @@ -1,49 +0,0 @@ -From d2bf497b12fbd49b4996ccf0744303ffd67735b1 Mon Sep 17 00:00:00 2001 -From: Andrew Paprocki -Date: Wed, 21 Dec 2022 11:15:00 -0500 -Subject: [PATCH 1/8] PR29926: debuginfod: Fix usage of deprecated CURLINFO_* - -The `CURLINFO_SIZE_DOWNLOAD_T` and `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T` -identifiers are `enum`s, not pre-processor definitions, so the current -`#ifdef` logic is not selecting the newer API. This results in the -older identifiers being used and they now generate errors when compiled -against Curl 7.87, which has silently deprecated them, causing GCC to -emit `-Werror=deprecated-declarations`. - -Instead, the newer identifiers were added in Curl 7.55, so explicitly -check for `CURL_AT_LEAST_VERSION(7, 55, 0)` instead of the current -logic. This eliminates the error when compiling against Curl 7.87. - -Ref: https://github.com/curl/curl/pull/1511 - -Signed-off-by: Andrew Paprocki ---- - debuginfod/ChangeLog | 4 ++++ - debuginfod/debuginfod-client.c | 4 ++-- - 2 files changed, 6 insertions(+), 2 deletions(-) - -diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c -index 8873fcc8..692aecce 100644 ---- a/debuginfod/debuginfod-client.c -+++ b/debuginfod/debuginfod-client.c -@@ -1456,7 +1456,7 @@ debuginfod_query_server (debuginfod_client *c, - deflate-compressing proxies, this number is likely to be - unavailable, so -1 may show. */ - CURLcode curl_res; --#ifdef CURLINFO_CONTENT_LENGTH_DOWNLOAD_T -+#if CURL_AT_LEAST_VERSION(7, 55, 0) - curl_off_t cl; - curl_res = curl_easy_getinfo(target_handle, - CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, -@@ -1491,7 +1491,7 @@ debuginfod_query_server (debuginfod_client *c, - if (target_handle) /* we've committed to a server; report its download progress */ - { - CURLcode curl_res; --#ifdef CURLINFO_SIZE_DOWNLOAD_T -+#if CURL_AT_LEAST_VERSION(7, 55, 0) - curl_off_t dl; - curl_res = curl_easy_getinfo(target_handle, - CURLINFO_SIZE_DOWNLOAD_T, --- -2.39.1 - diff --git a/elfutils-0.188-static-extract_section.patch b/elfutils-0.188-static-extract_section.patch deleted file mode 100644 index 6305b3e..0000000 --- a/elfutils-0.188-static-extract_section.patch +++ /dev/null @@ -1,24 +0,0 @@ -commit 58a7aa900bc2d9822b0d0cb596ba95a21ff0fd2d -Author: Mark Wielaard -Date: Wed Nov 2 17:54:11 2022 +0100 - - debuginfod: Mark extract_section function static - - The extract_section function in debuginfod-client.c is an internal - function and should not be exported. Mark it as static. - - Signed-off-by: Mark Wielaard - -diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c -index 0c4a00cf..f48e32cc 100644 ---- a/debuginfod/debuginfod-client.c -+++ b/debuginfod/debuginfod-client.c -@@ -621,7 +621,7 @@ path_escape (const char *src, char *dest) - section name was not found. -EEXIST indicates that the section was - found but had type SHT_NOBITS. */ - --int -+static int - extract_section (int fd, const char *section, char *fd_path, char **usr_path) - { - elf_version (EV_CURRENT); diff --git a/elfutils.spec b/elfutils.spec index 849868f..8d2b05b 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils -Version: 0.188 -%global baserelease 5 +Version: 0.189 +%global baserelease 1 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -74,16 +74,6 @@ BuildRequires: gettext-devel # For s390x... FDO package notes are bogus. Patch1: elfutils-0.186-fdo-swap.patch -# Don't export internal function. -Patch2: elfutils-0.188-static-extract_section.patch -# Silence some compiler warnings -Patch3: elfutils-0.188-compile-warnings.patch -# The debuginfod_client object lifetime needs more careful handling -Patch4: elfutils-0.188-debuginfod-client-lifetime.patch -# Various libcurl deprecated constants -Patch5: elfutils-0.188-deprecated-CURLINFO.patch -Patch6: elfutils-0.188-CURL_AT_LEAST_VERSION.patch -Patch7: elfutils-0.188-CURLOPT_PROTOCOLS_STR.patch %description Elfutils is a collection of utilities, including stack (to show @@ -452,6 +442,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Fri Mar 3 2023 Mark Wielaard - 0.189-1 +- Upgrade to upsteam elfutils 0.189. + * Fri Jan 27 2023 Mark Wielaard - 0.188-5 - Add elfutils-0.188-deprecated-CURLINFO.patch, elfutils-0.188-CURL_AT_LEAST_VERSION.patch and diff --git a/sources b/sources index 04cbb1b..57e5577 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (elfutils-0.188.tar.bz2) = 585551b2d937d19d1becfc2f28935db1dd1a3d25571a62f322b70ac8da98c1a741a55d070327705df6c3e2ee026652e0b9a3c733b050a0b0ec5f2fc75d5b74b5 +SHA512 (elfutils-0.189.tar.bz2) = 93a877e34db93e5498581d0ab2d702b08c0d87e4cafd9cec9d6636dfa85a168095c305c11583a5b0fb79374dd93bc8d0e9ce6016e6c172764bcea12861605b71 From 9c35539ea7fdb7255c9286ffe12443b60aab34d8 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 22 Apr 2023 22:23:26 +0200 Subject: [PATCH 5/9] Add elfutils-0.189-c99-compat.patch --- elfutils-0.189-c99-compat.patch | 31 +++++++++++++++++++++++++++++++ elfutils.spec | 5 +++++ 2 files changed, 36 insertions(+) create mode 100644 elfutils-0.189-c99-compat.patch diff --git a/elfutils-0.189-c99-compat.patch b/elfutils-0.189-c99-compat.patch new file mode 100644 index 0000000..4932c2c --- /dev/null +++ b/elfutils-0.189-c99-compat.patch @@ -0,0 +1,31 @@ +From 6e7ac623674242628c9e54892a532d55d3288bb8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer +Date: Sat, 22 Apr 2023 21:37:09 +0200 +Subject: [PATCH] testsuite: Avoid C99 compatibility issues in + run-native-test.sh + +Include for the pause function, and add the return type +of main. Avoids an implicit function declaration and implicit int. + +Signed-off-by: Florian Weimer +--- + tests/run-native-test.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/run-native-test.sh b/tests/run-native-test.sh +index d19007f2..042a51c6 100755 +--- a/tests/run-native-test.sh ++++ b/tests/run-native-test.sh +@@ -27,7 +27,8 @@ + # in all builds. + + tempfiles native.c native +-echo 'main () { while (1) pause (); }' > native.c ++printf '#include \nint main (void) { while (1) pause (); }\n' \ ++ > native.c + + native=0 + kill_native() +-- +2.31.1 + diff --git a/elfutils.spec b/elfutils.spec index 8d2b05b..8de0442 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -74,6 +74,8 @@ BuildRequires: gettext-devel # For s390x... FDO package notes are bogus. Patch1: elfutils-0.186-fdo-swap.patch +# testsuite: Avoid C99 compatibility issues in run-native-test.sh +Patch2: elfutils-0.189-c99-compat.patch %description Elfutils is a collection of utilities, including stack (to show @@ -442,6 +444,9 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Sat Apr 22 2023 Mark Wielaard +- Add elfutils-0.189-c99-compat.patch + * Fri Mar 3 2023 Mark Wielaard - 0.189-1 - Upgrade to upsteam elfutils 0.189. From 8ad902eac966d1cceb70d10e654ad6ab6a531b71 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 22 Apr 2023 22:28:38 +0200 Subject: [PATCH 6/9] Add elfutils-0.189-elfcompress.patch --- elfutils-0.189-elfcompress.patch | 95 ++++++++++++++++++++++++++++++++ elfutils.spec | 3 + 2 files changed, 98 insertions(+) create mode 100644 elfutils-0.189-elfcompress.patch diff --git a/elfutils-0.189-elfcompress.patch b/elfutils-0.189-elfcompress.patch new file mode 100644 index 0000000..5f0d681 --- /dev/null +++ b/elfutils-0.189-elfcompress.patch @@ -0,0 +1,95 @@ +From ef9164520c81ea61efe88777a8ad61bf17a54201 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 22 Apr 2023 01:26:17 +0200 +Subject: [PATCH] elfcompress: Don't compress if section already compressed + unless forced + +Before commit a5b07cdf9 "support ZSTD compression algorithm" +elfcompress would not try to compress a section if it already +had the requested compression type (or was already uncompressed) +unless the --force flag was given. An else if construct was changed +to an if in the commit causing elfcompress to warn (in verbose mode) +but then still try to (re)compress the section. + +Add an explicit check so if nothing needs (un)compressing, the file +isn't changed. + +The diff looks large, but git diff -b -w is just: + ++ if (force || type != schtype) ++ { + if (shdr->sh_type != SHT_NOBITS + && (shdr->sh_flags & SHF_ALLOC) == 0) + { +@@ -554,6 +556,7 @@ process_file (const char *fname) + printf ("[%zd] %s ignoring %s section\n", ndx, sname, + (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); + } ++ } + +Signed-off-by: Mark Wielaard +--- + src/elfcompress.c | 43 +++++++++++++++++++++++-------------------- + 1 file changed, 23 insertions(+), 20 deletions(-) + +diff --git a/src/elfcompress.c b/src/elfcompress.c +index 18ade66f..f771b92a 100644 +--- a/src/elfcompress.c ++++ b/src/elfcompress.c +@@ -529,30 +529,33 @@ process_file (const char *fname) + } + } + +- if (shdr->sh_type != SHT_NOBITS +- && (shdr->sh_flags & SHF_ALLOC) == 0) ++ if (force || type != schtype) + { +- set_section (sections, ndx); +- /* Check if we might want to change this section name. */ +- if (! adjust_names +- && ((type != ZLIB_GNU +- && startswith (sname, ".zdebug")) +- || (type == ZLIB_GNU +- && startswith (sname, ".debug")))) +- adjust_names = true; +- +- /* We need a buffer this large if we change the names. */ +- if (adjust_names) ++ if (shdr->sh_type != SHT_NOBITS ++ && (shdr->sh_flags & SHF_ALLOC) == 0) + { +- size_t slen = strlen (sname); +- if (slen > maxnamelen) +- maxnamelen = slen; ++ set_section (sections, ndx); ++ /* Check if we might want to change this section name. */ ++ if (! adjust_names ++ && ((type != ZLIB_GNU ++ && startswith (sname, ".zdebug")) ++ || (type == ZLIB_GNU ++ && startswith (sname, ".debug")))) ++ adjust_names = true; ++ ++ /* We need a buffer this large if we change the names. */ ++ if (adjust_names) ++ { ++ size_t slen = strlen (sname); ++ if (slen > maxnamelen) ++ maxnamelen = slen; ++ } + } ++ else ++ if (verbose >= 0) ++ printf ("[%zd] %s ignoring %s section\n", ndx, sname, ++ (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); + } +- else +- if (verbose >= 0) +- printf ("[%zd] %s ignoring %s section\n", ndx, sname, +- (shdr->sh_type == SHT_NOBITS ? "no bits" : "allocated")); + } + + if (shdr->sh_type == SHT_SYMTAB) +-- +2.31.1 + diff --git a/elfutils.spec b/elfutils.spec index 8de0442..f18aea2 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -76,6 +76,8 @@ BuildRequires: gettext-devel Patch1: elfutils-0.186-fdo-swap.patch # testsuite: Avoid C99 compatibility issues in run-native-test.sh Patch2: elfutils-0.189-c99-compat.patch +# elfcompress: Don't compress if section already compressed unless forced +Patch3: elfutils-0.189-elfcompress.patch %description Elfutils is a collection of utilities, including stack (to show @@ -446,6 +448,7 @@ exit 0 %changelog * Sat Apr 22 2023 Mark Wielaard - Add elfutils-0.189-c99-compat.patch +- Add elfutils-0.189-elfcompress.patch * Fri Mar 3 2023 Mark Wielaard - 0.189-1 - Upgrade to upsteam elfutils 0.189. From 8a6de994bea941fd76fb5b1e7d9b1c69f3a34029 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sat, 22 Apr 2023 22:29:20 +0200 Subject: [PATCH 7/9] 0.189-2 --- elfutils.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elfutils.spec b/elfutils.spec index f18aea2..86f3b34 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,6 +1,6 @@ Name: elfutils Version: 0.189 -%global baserelease 1 +%global baserelease 2 Release: %{baserelease}%{?dist} URL: http://elfutils.org/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/ @@ -446,7 +446,7 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog -* Sat Apr 22 2023 Mark Wielaard +* Sat Apr 22 2023 Mark Wielaard - 0.189-2 - Add elfutils-0.189-c99-compat.patch - Add elfutils-0.189-elfcompress.patch From db4d0ca23c3564dec7b9c98ec0e923723af36b72 Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 25 Apr 2023 12:40:59 +0200 Subject: [PATCH 8/9] CI Tests: Test cover rhbz2188064 --- .../eu-elfcompress-breaks-hard-links/bubble.c | 36 ++++++++++++ .../eu-elfcompress-breaks-hard-links/main.fmf | 15 +++++ .../runtest.sh | 55 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c create mode 100644 tests/Regression/eu-elfcompress-breaks-hard-links/main.fmf create mode 100755 tests/Regression/eu-elfcompress-breaks-hard-links/runtest.sh diff --git a/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c b/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c new file mode 100644 index 0000000..9ec3260 --- /dev/null +++ b/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c @@ -0,0 +1,36 @@ +/* Bubble sort code */ + +#include + +int main() +{ + int array[100], n, c, d, swap; + + printf("Enter number of elements\n"); + scanf("%d", &n); + + printf("Enter %d integers\n", n); + + for (c = 0; c < n; c++) + scanf("%d", &array[c]); + + for (c = 0 ; c < n - 1; c++) + { + for (d = 0 ; d < n - c - 1; d++) + { + if (array[d] > array[d+1]) /* For decreasing order use '<' instead of '>' */ + { + swap = array[d]; + array[d] = array[d+1]; + array[d+1] = swap; + } + } + } + + printf("Sorted list in ascending order:\n"); + + for (c = 0; c < n; c++) + printf("%d\n", array[c]); + + return 0; +} diff --git a/tests/Regression/eu-elfcompress-breaks-hard-links/main.fmf b/tests/Regression/eu-elfcompress-breaks-hard-links/main.fmf new file mode 100644 index 0000000..a34c573 --- /dev/null +++ b/tests/Regression/eu-elfcompress-breaks-hard-links/main.fmf @@ -0,0 +1,15 @@ +summary: eu-elfcompress-breaks-hard-links +description: '' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=2188064 +contact: Martin Cermak +component: + - elfutils +test: ./runtest.sh +framework: beakerlib +recommend: + - elfutils + - gcc +duration: 1h +extra-summary: /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links +extra-task: /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links diff --git a/tests/Regression/eu-elfcompress-breaks-hard-links/runtest.sh b/tests/Regression/eu-elfcompress-breaks-hard-links/runtest.sh new file mode 100755 index 0000000..7709a74 --- /dev/null +++ b/tests/Regression/eu-elfcompress-breaks-hard-links/runtest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/elfutils/Regression/eu-elfcompress-breaks-hard-links +# Description: eu-elfcompress-breaks-hard-links +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2023 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="elfutils" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TMP=$(mktemp -d)" + rlRun "cp bubble.c $TMP/" + rlRun "pushd $TMP" + rlPhaseEnd + + rlPhaseStartTest + rlRun "gcc -o a.out -g bubble.c" + rlRun "ln a.out a.lnk" + rlRun "eu-elfcompress -q -p -t none a.lnk" + rlRun "i0=$(stat -c '%i' a.out)" + rlRun "i1=$(stat -c '%i' a.lnk)" + rlRun "test $i0 -eq $i1" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd From 96c09f6385bfc88130b308b8046294a1dbcfbb0e Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 25 Apr 2023 12:50:10 +0200 Subject: [PATCH 9/9] CI Tests: Simplify test for rhbz2188064 --- .../eu-elfcompress-breaks-hard-links/bubble.c | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c b/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c index 9ec3260..f8b643a 100644 --- a/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c +++ b/tests/Regression/eu-elfcompress-breaks-hard-links/bubble.c @@ -1,36 +1,4 @@ -/* Bubble sort code */ - -#include - int main() { - int array[100], n, c, d, swap; - - printf("Enter number of elements\n"); - scanf("%d", &n); - - printf("Enter %d integers\n", n); - - for (c = 0; c < n; c++) - scanf("%d", &array[c]); - - for (c = 0 ; c < n - 1; c++) - { - for (d = 0 ; d < n - c - 1; d++) - { - if (array[d] > array[d+1]) /* For decreasing order use '<' instead of '>' */ - { - swap = array[d]; - array[d] = array[d+1]; - array[d+1] = swap; - } - } - } - - printf("Sorted list in ascending order:\n"); - - for (c = 0; c < n; c++) - printf("%d\n", array[c]); - return 0; }