[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1055656: bookworm-pu: package ms-gsl/4.0.0-2+deb12u1



Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org@packages.debian.org
Usertags: pu

Dear Release Team,

[ Reason ]
The libmsgsl-dev package in stable is currently incompatible with std::variant
from GNU's libstdc++. To solve this issue, I propose a patch adding conditional
noexcept for the gsl::not_null template constructors.

[ Impact ]
My fix is necessary for backporting the newer versions of the telegram-desktop
package to the bookworm release. This is merely a bug fix so it should go to
stable-updates as per policy. https://backports.debian.org/Contribute/#index1h3

[ Tests ]
Manual. Published and viewed stories in Telegram Desktop.

[ Risks ]
Little. This header-only library has only one dependant, and for the changes to
be effective, the dependant package is need to be rebuilt.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
Only single new patch with the fix and autotests. For convenience, you can
review the difference in our GitLab.

https://salsa.debian.org/debian/ms-gsl/-/compare/debian%2Fmaster...debian%2Fbookworm

[ Other info ]
Additional information can be obtained from the related bug reports here, in
Debian bug tracker, and on GitHub.
diffstat for ms-gsl-4.0.0 ms-gsl-4.0.0

 changelog                                                |    6 +
 patches/Mark-gsl-not_null-constructors-as-noexcept.patch |   60 +++++++++++++++
 patches/series                                           |    1 
 3 files changed, 67 insertions(+)

diff -Nru ms-gsl-4.0.0/debian/changelog ms-gsl-4.0.0/debian/changelog
--- ms-gsl-4.0.0/debian/changelog	2022-02-05 23:19:23.000000000 +0300
+++ ms-gsl-4.0.0/debian/changelog	2023-11-09 20:07:33.000000000 +0300
@@ -1,3 +1,9 @@
+ms-gsl (4.0.0-2+deb12u1) bookworm; urgency=medium
+
+  * New Mark-gsl-not_null-constructors-as-noexcept.patch (Closes: #1051289)
+
+ -- Nicholas Guriev <guriev-ns@ya.ru>  Thu, 09 Nov 2023 20:07:33 +0300
+
 ms-gsl (4.0.0-2) unstable; urgency=medium
 
   * Ignore -Wpsabi warnings on PowerPC.
diff -Nru ms-gsl-4.0.0/debian/patches/Mark-gsl-not_null-constructors-as-noexcept.patch ms-gsl-4.0.0/debian/patches/Mark-gsl-not_null-constructors-as-noexcept.patch
--- ms-gsl-4.0.0/debian/patches/Mark-gsl-not_null-constructors-as-noexcept.patch	1970-01-01 03:00:00.000000000 +0300
+++ ms-gsl-4.0.0/debian/patches/Mark-gsl-not_null-constructors-as-noexcept.patch	2023-11-08 17:00:49.000000000 +0300
@@ -0,0 +1,60 @@
+Description: Mark gsl::not_null constructors as noexcept when underlying type can be moved with no exception
+Bug-GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106547
+Bug-Debian: https://bugs.debian.org/1051289
+Forwarded: https://github.com/microsoft/GSL/pull/1135
+Author: Nicholas Guriev <guriev-ns@ya.ru>
+Last-Update: Tue, 05 Sep 2023 23:00:33 +0300
+
+--- a/include/gsl/pointers
++++ b/include/gsl/pointers
+@@ -87,19 +87,19 @@ public:
+     static_assert(details::is_comparable_to_nullptr<T>::value, "T cannot be compared to nullptr.");
+ 
+     template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+-    constexpr not_null(U&& u) : ptr_(std::forward<U>(u))
++    constexpr not_null(U&& u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::forward<U>(u))
+     {
+         Expects(ptr_ != nullptr);
+     }
+ 
+     template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>>
+-    constexpr not_null(T u) : ptr_(std::move(u))
++    constexpr not_null(T u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::move(u))
+     {
+         Expects(ptr_ != nullptr);
+     }
+ 
+     template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
+-    constexpr not_null(const not_null<U>& other) : not_null(other.get())
++    constexpr not_null(const not_null<U>& other) noexcept(std::is_nothrow_move_constructible<T>::value) : not_null(other.get())
+     {}
+ 
+     not_null(const not_null& other) = default;
+--- a/tests/notnull_tests.cpp
++++ b/tests/notnull_tests.cpp
+@@ -24,6 +24,7 @@
+ #include <stdint.h>  // for uint16_t
+ #include <string>    // for basic_string, operator==, string, operator<<
+ #include <typeinfo>  // for type_info
++#include <variant>   // for variant, monostate, get
+ 
+ #include "deathTestCommon.h"
+ using namespace gsl;
+@@ -489,6 +490,17 @@ TEST(notnull_tests, TestNotNullConstruct
+     }
+ #endif
+ }
++
++TEST(notnull_tests, TestVariantEmplace)
++{
++    int i = 0;
++    std::variant<std::monostate, not_null<int*>> v;
++    v.emplace<not_null<int*>>(&i);
++
++    EXPECT_FALSE(v.valueless_by_exception());
++    EXPECT_TRUE(v.index() == 1);
++    EXPECT_TRUE(std::get<1>(v) == &i);
++}
+ #endif // #if defined(__cplusplus) && (__cplusplus >= 201703L)
+ 
+ TEST(notnull_tests, TestMakeNotNull)
diff -Nru ms-gsl-4.0.0/debian/patches/series ms-gsl-4.0.0/debian/patches/series
--- ms-gsl-4.0.0/debian/patches/series	2022-02-03 18:42:25.000000000 +0300
+++ ms-gsl-4.0.0/debian/patches/series	2023-11-08 17:00:49.000000000 +0300
@@ -1 +1,2 @@
+Mark-gsl-not_null-constructors-as-noexcept.patch
 PowerPC-warn-suppression.patch

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: