From 3c3086c1820e0c03aeb68c147a723ffa9a113040 Mon Sep 17 00:00:00 2001 From: chen-jan Date: Thu, 20 Jul 2023 10:47:25 +0800 Subject: [PATCH] Do not define the clamp macro when compiling C++ code --- ...efine-the-clamp-macro-when-compiling.patch | 38 +++++++++++++++++++ dpkg.spec | 6 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch diff --git a/0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch b/0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch new file mode 100644 index 0000000..8f0ea50 --- /dev/null +++ b/0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch @@ -0,0 +1,38 @@ +From 7149af4125f76422e320c3d1f9d9308e9259bdf9 Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Wed, 23 Dec 2020 17:23:49 +0100 +Subject: [PATCH] libdpkg: Do not define the clamp macro when compiling C++ + code + +Newer versions of the C++ standard define a clamp function in the STL, +which gets messed up by our macro. + +Reported-by: Helmut Grohne +Warned-by: g++ -std=gnu++17 +Changelog: internal + +reference: https://git.dpkg.org/git/dpkg/dpkg.git/commit/?id=7149af4125f76422e320c3d1f9d9308e9259bdf9 +--- + lib/dpkg/macros.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/dpkg/macros.h b/lib/dpkg/macros.h +index 6eaedf844..a4776570a 100644 +--- a/lib/dpkg/macros.h ++++ b/lib/dpkg/macros.h +@@ -153,9 +153,12 @@ + * @param l The low limit. + * @param h The high limit. + */ ++/* For C++ use native implementations from STL or similar. */ ++#ifndef __cplusplus + #ifndef clamp + #define clamp(v, l, h) ((v) > (h) ? (h) : ((v) < (l) ? (l) : (v))) + #endif ++#endif + + /** @} */ + +-- +2.41.0 + diff --git a/dpkg.spec b/dpkg.spec index cae3b5e..147a605 100644 --- a/dpkg.spec +++ b/dpkg.spec @@ -2,7 +2,7 @@ Name: dpkg Version: 1.18.25 -Release: 13 +Release: 14 Summary: Package maintenance system for Debian Linux License: GPL-2.0-only and GPL-2.0-or-later and LGPL-2.0-or-later and Public Domain and BSD-2-Clause URL: https://tracker.debian.org/pkg/dpkg @@ -26,6 +26,7 @@ Patch1: dpkg-fix-logrotate.patch Patch2: dpkg-log-Change-logfile-permission-to-satisfy-with-s.patch Patch3: CVE-2022-1664.patch Patch4: add-loongarch-support-for-dpkg.patch +Patch5: 0001-libdpkg-Do-not-define-the-clamp-macro-when-compiling.patch %description Dpkg is a tool to install, build, remove and manageDebian packages. The @@ -238,6 +239,9 @@ chown root:root /var/log/dpkg.log 2>/dev/null || chown 0:0 /var/log/dpkg.log %endif %changelog +* Thu Jul 20 2023 chenchen - 1.18.25-14 +- Do not define the clamp macro when compiling C++ code + * Fri Mar 10 2023 Wenlong Zhang - 1.18.25-13 - add loongarch support for dpkg