From 7a6aa4ff4129869e0a367205d145a39f0cb87409 Mon Sep 17 00:00:00 2001 From: lifeifei Date: Tue, 30 Jul 2024 20:18:38 +0800 Subject: [PATCH] backport-Replace-auto_ptr-with-unique_ptr --- atf.spec | 10 +- ...ort-Replace-auto_ptr-with-unique_ptr.patch | 191 ++++++++++++++++++ 2 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 backport-Replace-auto_ptr-with-unique_ptr.patch diff --git a/atf.spec b/atf.spec index 325629d..fdf46ab 100644 --- a/atf.spec +++ b/atf.spec @@ -1,6 +1,6 @@ Name: atf Version: 0.21 -Release: 2 +Release: 3 License: BSD Summary: Testing Framework for Automated URL: https://github.com/jmmv/atf/ @@ -8,6 +8,8 @@ Source0: https://github.com/jmmv/atf/archive/atf-0.21.tar.gz BuildRequires: gcc-c++ autoconf libtool +Patch1: backport-Replace-auto_ptr-with-unique_ptr.patch + %description No main package is built here. Because it is not used. @@ -137,6 +139,12 @@ make check %{_mandir}/man7/* %changelog +* Mon Jul 29 2024 lifeifei - 0.21-3 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:Migration patch from upstream:auto_ptr is remove in C++17 and later, replace auto_ptr with unique_ptr. + * Thu Dec 31 2020 Ge Wang - 0.21-2 - Modify Source url and remove redundancy source file diff --git a/backport-Replace-auto_ptr-with-unique_ptr.patch b/backport-Replace-auto_ptr-with-unique_ptr.patch new file mode 100644 index 0000000..0161e5a --- /dev/null +++ b/backport-Replace-auto_ptr-with-unique_ptr.patch @@ -0,0 +1,191 @@ +diff -apurN atf-atf-0.21/atf-c++/check.cpp atf-atf-0.21-new/atf-c++/check.cpp +--- atf-atf-0.21/atf-c++/check.cpp 2014-10-24 04:07:41.000000000 +0800 ++++ atf-atf-0.21-new/atf-c++/check.cpp 2024-07-30 19:53:07.590656855 +0800 +@@ -141,7 +141,7 @@ impl::build_cxx_o(const std::string& sfi + return success; + } + +-std::auto_ptr< impl::check_result > ++std::unique_ptr< impl::check_result > + impl::exec(const atf::process::argv_array& argva) + { + atf_check_result_t result; +@@ -150,5 +150,5 @@ impl::exec(const atf::process::argv_arra + if (atf_is_error(err)) + throw_atf_error(err); + +- return std::auto_ptr< impl::check_result >(new impl::check_result(&result)); ++ return std::unique_ptr< impl::check_result >(new impl::check_result(&result)); + } +diff -apurN atf-atf-0.21/atf-c++/check.hpp atf-atf-0.21-new/atf-c++/check.hpp +--- atf-atf-0.21/atf-c++/check.hpp 2014-10-24 04:07:41.000000000 +0800 ++++ atf-atf-0.21-new/atf-c++/check.hpp 2024-07-30 19:53:58.700962607 +0800 +@@ -71,7 +71,7 @@ class check_result { + check_result(const atf_check_result_t* result); + + friend check_result test_constructor(const char* const*); +- friend std::auto_ptr< check_result > exec(const atf::process::argv_array&); ++ friend std::unique_ptr< check_result > exec(const atf::process::argv_array&); + + public: + //! +@@ -120,7 +120,7 @@ bool build_cpp(const std::string&, const + const atf::process::argv_array&); + bool build_cxx_o(const std::string&, const std::string&, + const atf::process::argv_array&); +-std::auto_ptr< check_result > exec(const atf::process::argv_array&); ++std::unique_ptr< check_result > exec(const atf::process::argv_array&); + + // Useful for testing only. + check_result test_constructor(void); +diff -apurN atf-atf-0.21/atf-c++/check_test.cpp atf-atf-0.21-new/atf-c++/check_test.cpp +--- atf-atf-0.21/atf-c++/check_test.cpp 2014-10-24 04:07:41.000000000 +0800 ++++ atf-atf-0.21-new/atf-c++/check_test.cpp 2024-07-30 19:55:20.703453160 +0800 +@@ -52,7 +52,7 @@ extern "C" { + // ------------------------------------------------------------------------ + + static +-std::auto_ptr< atf::check::check_result > ++std::unique_ptr< atf::check::check_result > + do_exec(const atf::tests::tc* tc, const char* helper_name) + { + std::vector< std::string > argv; +@@ -65,7 +65,7 @@ do_exec(const atf::tests::tc* tc, const + } + + static +-std::auto_ptr< atf::check::check_result > ++std::unique_ptr< atf::check::check_result > + do_exec(const atf::tests::tc* tc, const char* helper_name, const char *carg2) + { + std::vector< std::string > argv; +@@ -248,11 +248,11 @@ ATF_TEST_CASE_HEAD(exec_cleanup) + } + ATF_TEST_CASE_BODY(exec_cleanup) + { +- std::auto_ptr< atf::fs::path > out; +- std::auto_ptr< atf::fs::path > err; ++ std::unique_ptr< atf::fs::path > out; ++ std::unique_ptr< atf::fs::path > err; + + { +- std::auto_ptr< atf::check::check_result > r = ++ std::unique_ptr< atf::check::check_result > r = + do_exec(this, "exit-success"); + out.reset(new atf::fs::path(r->stdout_path())); + err.reset(new atf::fs::path(r->stderr_path())); +@@ -272,7 +272,7 @@ ATF_TEST_CASE_HEAD(exec_exitstatus) + ATF_TEST_CASE_BODY(exec_exitstatus) + { + { +- std::auto_ptr< atf::check::check_result > r = ++ std::unique_ptr< atf::check::check_result > r = + do_exec(this, "exit-success"); + ATF_REQUIRE(r->exited()); + ATF_REQUIRE(!r->signaled()); +@@ -280,7 +280,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus) + } + + { +- std::auto_ptr< atf::check::check_result > r = ++ std::unique_ptr< atf::check::check_result > r = + do_exec(this, "exit-failure"); + ATF_REQUIRE(r->exited()); + ATF_REQUIRE(!r->signaled()); +@@ -288,7 +288,7 @@ ATF_TEST_CASE_BODY(exec_exitstatus) + } + + { +- std::auto_ptr< atf::check::check_result > r = ++ std::unique_ptr< atf::check::check_result > r = + do_exec(this, "exit-signal"); + ATF_REQUIRE(!r->exited()); + ATF_REQUIRE(r->signaled()); +@@ -321,12 +321,12 @@ ATF_TEST_CASE_HEAD(exec_stdout_stderr) + } + ATF_TEST_CASE_BODY(exec_stdout_stderr) + { +- std::auto_ptr< atf::check::check_result > r1 = ++ std::unique_ptr< atf::check::check_result > r1 = + do_exec(this, "stdout-stderr", "result1"); + ATF_REQUIRE(r1->exited()); + ATF_REQUIRE_EQ(r1->exitcode(), EXIT_SUCCESS); + +- std::auto_ptr< atf::check::check_result > r2 = ++ std::unique_ptr< atf::check::check_result > r2 = + do_exec(this, "stdout-stderr", "result2"); + ATF_REQUIRE(r2->exited()); + ATF_REQUIRE_EQ(r2->exitcode(), EXIT_SUCCESS); +@@ -372,7 +372,7 @@ ATF_TEST_CASE_BODY(exec_unknown) + argv.push_back("/foo/bar/non-existent"); + + atf::process::argv_array argva(argv); +- std::auto_ptr< atf::check::check_result > r = atf::check::exec(argva); ++ std::unique_ptr< atf::check::check_result > r = atf::check::exec(argva); + ATF_REQUIRE(r->exited()); + ATF_REQUIRE_EQ(r->exitcode(), 127); + } +diff -apurN atf-atf-0.21/atf-c++/detail/process_test.cpp atf-atf-0.21-new/atf-c++/detail/process_test.cpp +--- atf-atf-0.21/atf-c++/detail/process_test.cpp 2014-10-24 04:07:41.000000000 +0800 ++++ atf-atf-0.21-new/atf-c++/detail/process_test.cpp 2024-07-30 19:56:04.374714414 +0800 +@@ -196,8 +196,8 @@ ATF_TEST_CASE_BODY(argv_array_assign) + const char* const carray1[] = { "arg1", NULL }; + const char* const carray2[] = { "arg1", "arg2", NULL }; + +- std::auto_ptr< argv_array > argv1(new argv_array(carray1)); +- std::auto_ptr< argv_array > argv2(new argv_array(carray2)); ++ std::unique_ptr< argv_array > argv1(new argv_array(carray1)); ++ std::unique_ptr< argv_array > argv2(new argv_array(carray2)); + + *argv2 = *argv1; + ATF_REQUIRE_EQ(argv2->size(), argv1->size()); +@@ -226,8 +226,8 @@ ATF_TEST_CASE_BODY(argv_array_copy) + + const char* const carray[] = { "arg0", NULL }; + +- std::auto_ptr< argv_array > argv1(new argv_array(carray)); +- std::auto_ptr< argv_array > argv2(new argv_array(*argv1)); ++ std::unique_ptr< argv_array > argv1(new argv_array(carray)); ++ std::unique_ptr< argv_array > argv2(new argv_array(*argv1)); + + ATF_REQUIRE_EQ(argv2->size(), argv1->size()); + ATF_REQUIRE(std::strcmp((*argv2)[0], (*argv1)[0]) == 0); +diff -apurN atf-atf-0.21/atf-sh/atf-check.cpp atf-atf-0.21-new/atf-sh/atf-check.cpp +--- atf-atf-0.21/atf-sh/atf-check.cpp 2014-10-24 04:07:41.000000000 +0800 ++++ atf-atf-0.21-new/atf-sh/atf-check.cpp 2024-07-30 19:57:35.822261470 +0800 +@@ -103,7 +103,7 @@ struct output_check { + }; + + class temp_file : public std::ostream { +- std::auto_ptr< atf::fs::path > m_path; ++ std::unique_ptr< atf::fs::path > m_path; + int m_fd; + + public: +@@ -326,7 +326,7 @@ flatten_argv(char* const* argv) + } + + static +-std::auto_ptr< atf::check::check_result > ++std::unique_ptr< atf::check::check_result > + execute(const char* const* argv) + { + // TODO: This should go to stderr... but fixing it now may be hard as test +@@ -342,7 +342,7 @@ execute(const char* const* argv) + } + + static +-std::auto_ptr< atf::check::check_result > ++std::unique_ptr< atf::check::check_result > + execute_with_shell(char* const* argv) + { + const std::string cmd = flatten_argv(argv); +@@ -802,7 +802,7 @@ atf_check::main(void) + + int status = EXIT_FAILURE; + +- std::auto_ptr< atf::check::check_result > r = ++ std::unique_ptr< atf::check::check_result > r = + m_xflag ? execute_with_shell(m_argv) : execute(m_argv); + + if (m_status_checks.empty()) -- Gitee