!43 Adapts to gcc-12 and python-3.11

From: @langfei295455 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2023-08-09 06:54:56 +00:00 committed by Gitee
commit 3beaee92c6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 131 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From f199d1982ef8a6c6d5c06c082d057b8793bcc6aa Mon Sep 17 00:00:00 2001
From: Serhei Makarov <serhei@serhei.io>
Date: Fri, 21 Jan 2022 18:21:46 -0500
Subject: [PATCH] gcc12 c++ compatibility re-tweak for rhel6: use function
pointer instead of lambdas instead of ptr_fun<>
Saving 2 lines in ltrim/rtrim is probably not a good reason to drop
compatibility with the RHEL6 system compiler. Actually declaring a
named function and passing the function pointer is compatible with
everything.
---
util.cxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/util.cxx b/util.cxx
index e9286eca3..ad36259c9 100644
--- a/util.cxx
+++ b/util.cxx
@@ -1757,21 +1757,24 @@ flush_to_stream (const string &fname, ostream &o)
return 1; // Failure
}
+int
+not_isspace(unsigned char c)
+{
+ return !std::isspace(c);
+}
+
// trim from start (in place)
void
ltrim(std::string &s)
{
- s.erase(s.begin(),
- std::find_if(s.begin(), s.end(),
- [](unsigned char c) { return !std::isspace(c); }));
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_isspace));
}
// trim from end (in place)
void
rtrim(std::string &s)
{
- s.erase(std::find_if(s.rbegin(), s.rend(),
- [](unsigned char c) { return !std::isspace(c); }).base(), s.end());
+ s.erase(std::find_if(s.rbegin(), s.rend(), not_isspace).base(), s.end());
}
// trim from both ends (in place)
--
2.21.0.windows.1

View File

@ -0,0 +1,37 @@
From 56c498d95c4749f15980da73b4933e7443b3f26c Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Date: Tue, 18 Jan 2022 15:52:18 -0500
Subject: [PATCH] gcc12 c++ compatibility tweak: use lambdas instead of
ptr_fun<>
Even while stap is a c++11 code base, such cleanups make code
nicer to look at.
---
util.cxx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util.cxx b/util.cxx
index c20f76003..e9286eca3 100644
--- a/util.cxx
+++ b/util.cxx
@@ -1763,7 +1763,7 @@ ltrim(std::string &s)
{
s.erase(s.begin(),
std::find_if(s.begin(), s.end(),
- std::not1(std::ptr_fun<int, int>(std::isspace))));
+ [](unsigned char c) { return !std::isspace(c); }));
}
// trim from end (in place)
@@ -1771,7 +1771,7 @@ void
rtrim(std::string &s)
{
s.erase(std::find_if(s.rbegin(), s.rend(),
- std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
+ [](unsigned char c) { return !std::isspace(c); }).base(), s.end());
}
// trim from both ends (in place)
--
2.21.0.windows.1

View File

@ -0,0 +1,33 @@
From 069e109c95d1afca17cd3781b39f220cf8b39978 Mon Sep 17 00:00:00 2001
From: Stan Cox <scox@redhat.com>
Date: Wed, 13 Jul 2022 09:49:51 -0400
Subject: [PATCH] python 3.11 removed direct access to PyFrameObject members
Take into account the change in PyFrameObject definition to allow
building systemtap with python 3.11. Additional support for python
3.11 is forthcoming.
---
python/HelperSDT/_HelperSDT.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/python/HelperSDT/_HelperSDT.c b/python/HelperSDT/_HelperSDT.c
index 967cb6077..4d287132e 100644
--- a/python/HelperSDT/_HelperSDT.c
+++ b/python/HelperSDT/_HelperSDT.c
@@ -14,7 +14,13 @@
// PR25841: ensure that the libHelperSDT.so file contains debuginfo
// for the tapset helper functions, so they don't have to look into libpython*
#include <frameobject.h>
+// python 3.11 removed direct access to PyFrameObject members
+// https://docs.python.org/3.11/whatsnew/3.11.html#c-api-changes
+#if PY_MAJOR_VERSION <= 3 && PY_MINOR_VERSION < 11
PyFrameObject _dummy_frame;
+#else
+//PyFrameObject *_dummy_frame;
+#endif
#include <object.h>
PyVarObject _dummy_var;
#include <dictobject.h>
--
2.21.0.windows.1

View File

@ -22,7 +22,7 @@
Name: systemtap
Version: 4.5
Release: 6
Release: 7
Summary: Linux trace and probe tool
License: GPLv2+ and Public Domain
URL: http://sourceware.org/systemtap
@ -30,6 +30,9 @@ Source: https://sourceware.org/systemtap/ftp/releases/%{name}-%{version}.tar.gz
Patch1: 0001-Add-init-type-cast-to-resolve-gcc-issue.patch
Patch2: 0001-PR29094-Include-rpm-rpmcrypto.h-when-required.patch
Patch3: 0001-gcc12-c-compatibility-tweak-use-lambdas-instead-of-p.patch
Patch4: 0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch
Patch5: 0001-python-3.11-removed-direct-access-to-PyFrameObject-m.patch
Patch9000: huawei-fix-py3example-script-run-fail.patch
Patch9001: huawei-fix-py3example-script-run-fail2.patch
@ -462,6 +465,12 @@ exit 0
%{_mandir}/man[1378]/*
%changelog
* Tue Aug 8 2023 langfei<langfei@huawei.com> - 4.5-7
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Adapts to gcc 12 and python 3.11
* Wed Jul 5 2023 langfei<langfei@huawei.com> - 4.5-6
- Type:bugfix
- CVE:NA