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
This commit is contained in:
Mark Wielaard 2023-01-27 19:09:16 +01:00
parent a1e6f5590c
commit c468385a0e
4 changed files with 130 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 6560fb26a62ef135a804357ef4f15a47de3e49b3 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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 <mark@klomp.org>
---
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

View File

@ -0,0 +1,36 @@
From 304741e11018c29e7ff17751e05dcc5c786a3fd9 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
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 <mark@klomp.org>
---
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 <fts.h>
#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 <pthread.h>
static pthread_once_t init_control = PTHREAD_ONCE_INIT;
--
2.39.1

View File

@ -0,0 +1,49 @@
From d2bf497b12fbd49b4996ccf0744303ffd67735b1 Mon Sep 17 00:00:00 2001
From: Andrew Paprocki <andrew@ishiboo.com>
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 <andrew@ishiboo.com>
---
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

View File

@ -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 <mjw@fedoraproject.org> - 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 <releng@fedoraproject.org> - 0.188-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild