From 5df7a377f7350ab70a0ec19a998d7edf66a07b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 11 Sep 2022 23:28:08 +0700 Subject: [PATCH 1/3] boost: fix segfault in asio+align module. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: Érico Nogueira --- .../boost/patches/feature-test-macros.patch | 32 +++++++++++++++++++ srcpkgs/boost/template | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/boost/patches/feature-test-macros.patch diff --git a/srcpkgs/boost/patches/feature-test-macros.patch b/srcpkgs/boost/patches/feature-test-macros.patch new file mode 100644 index 000000000000..14849a248703 --- /dev/null +++ b/srcpkgs/boost/patches/feature-test-macros.patch @@ -0,0 +1,32 @@ +boost/align/aligned_alloc.hpp is wrong, it uses feature test macros to +determine whether something is available; +FTMs shouldn't be in user code outside of top level #define's. + +This lead to an issue on musl where libtorrent-rasterbar was including this +header (via boost asio) from two different places, and segfaulting due to +mismatched implementations -- one's the posix one using posix_memalign, the +other one's the generic one that stores a pointer to itself. + +posix_memalign is always available on the libcs we support and should always be +used, so we force that. We still leave applications with the option of forcing +boost specific behavior, if they really want it. + +Instead of patching only boost/align/aligned_alloc.hpp, which fix the +bug if boost::asio is used, but may keep other boost's code use feature tests +macro, now or later, let's patch boost/config.hpp to always define +_XOPEN_SOURCE instead. + +--- a/boost/config.hpp ++++ b/boost/config.hpp +@@ -17,6 +17,11 @@ + #ifndef BOOST_CONFIG_HPP + #define BOOST_CONFIG_HPP + ++#ifdef __linux__ ++/* for _XOPEN_SOURCE and/or _POSIX_C_SOURCE */ ++#include ++#endif ++ + // if we don't have a user config, then use the default location: + #if !defined(BOOST_USER_CONFIG) && !defined(BOOST_NO_USER_CONFIG) + # define BOOST_USER_CONFIG diff --git a/srcpkgs/boost/template b/srcpkgs/boost/template index 57ad72b545f9..e47bd7d251b5 100644 --- a/srcpkgs/boost/template +++ b/srcpkgs/boost/template @@ -1,7 +1,7 @@ # Template file for 'boost' pkgname=boost version=1.80.0 -revision=1 +revision=2 wrksrc="${pkgname}_${version//\./_}" hostmakedepends="which bzip2-devel icu-devel python3-devel pkg-config" makedepends="zlib-devel bzip2-devel icu-devel python3-devel liblzma-devel From 7e3b1d2296479337542298abd38eecaa20a189c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Wed, 7 Sep 2022 17:34:19 -0300 Subject: [PATCH 2/3] libtorrent-rasterbar: rebuild to fix segfault. Since asio is a header-only library, we need to rebuild its dependents. --- common/shlibs | 2 +- srcpkgs/libtorrent-rasterbar/template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/shlibs b/common/shlibs index fe0fe43e281c..ae39d4551d59 100644 --- a/common/shlibs +++ b/common/shlibs @@ -2094,7 +2094,7 @@ libldns.so.3 libldns-1.7.1_4 libopenjpeg.so.5 libopenjpeg-1.5.2_1 liboping.so.0 liboping-1.8.0_1 libloudmouth-1.so.0 loudmouth-1.5.3_12 -libtorrent-rasterbar.so.10 libtorrent-rasterbar-1.2.17_1 +libtorrent-rasterbar.so.10 libtorrent-rasterbar-1.2.17_2 libcapstone.so.4 capstone-4.0_1 libhavege.so.2 libhaveged-1.9.11_1 libnih.so.1 libnih-1.0.3_1 diff --git a/srcpkgs/libtorrent-rasterbar/template b/srcpkgs/libtorrent-rasterbar/template index 52377b39eca4..135d89b9c85a 100644 --- a/srcpkgs/libtorrent-rasterbar/template +++ b/srcpkgs/libtorrent-rasterbar/template @@ -2,7 +2,7 @@ # Breaks ABI/API without changing soname, revbump all dependants pkgname=libtorrent-rasterbar version=1.2.17 -revision=1 +revision=2 build_style=cmake configure_args="DCMAKE_CXX_STANDARD=14 -Dbuild_examples=ON -Dbuild_tools=ON -Dpython-bindings=ON" From e9061f9c114123b9ebd0d55aa84464f220fcb2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sun, 11 Sep 2022 23:31:01 +0700 Subject: [PATCH 3/3] qbittorrent: rebuild for boost-asio fix --- srcpkgs/qbittorrent/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/qbittorrent/template b/srcpkgs/qbittorrent/template index 67e6b94edc53..e8e96200b845 100644 --- a/srcpkgs/qbittorrent/template +++ b/srcpkgs/qbittorrent/template @@ -1,7 +1,7 @@ # Template file for 'qbittorrent' pkgname=qbittorrent version=4.4.3.1 -revision=2 +revision=3 create_wrksrc=yes build_style=gnu-configure build_helper=qmake