summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorAlfred Persson Forsberg <cat@catcream.org>2022-06-29 17:45:36 +0000
committerMike Gilbert <floppym@gentoo.org>2022-07-07 11:08:48 -0400
commitb48169ca772187d66007a3fd051df57a5d152303 (patch)
treefde5ef8fe2e8abeb4e2c05b49d5e32e5b82c8c88 /sys-fs
parentwww-apps/phpBB: Bump to 3.3.8, drop old 3.3.7 (diff)
downloadgentoo-b48169ca772187d66007a3fd051df57a5d152303.tar.gz
gentoo-b48169ca772187d66007a3fd051df57a5d152303.tar.bz2
gentoo-b48169ca772187d66007a3fd051df57a5d152303.zip
sys-fs/lvm2: fix segfault on musl
The default streams in musl are const and we can't modify them directly. Use freopen instead. https://listman.redhat.com/archives/lvm-devel/2022-June/024203.html See also: https://wiki.gentoo.org/wiki/User:Sam/Musl_porting_notes#error:_assignment_of_read-only_variable_.27.5Bstdout.7Cstdin.7Cstderr.5D.27 https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html Signed-off-by: Alfred Persson Forsberg <cat@catcream.org> Closes: https://github.com/gentoo/gentoo/pull/26024 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/lvm2/files/lvm2-2.03.14-freopen_n2.patch34
-rw-r--r--sys-fs/lvm2/lvm2-2.03.14-r3.ebuild (renamed from sys-fs/lvm2/lvm2-2.03.14-r2.ebuild)1
2 files changed, 35 insertions, 0 deletions
diff --git a/sys-fs/lvm2/files/lvm2-2.03.14-freopen_n2.patch b/sys-fs/lvm2/files/lvm2-2.03.14-freopen_n2.patch
new file mode 100644
index 000000000000..5ca32f19fc54
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.03.14-freopen_n2.patch
@@ -0,0 +1,34 @@
+In musl, the standard streams are read-only. To modify them we need to
+use freopen. This patch does the same as lvm2-2.03.14-r1-fopen-to-freopen.patch
+
+https://listman.redhat.com/archives/lvm-devel/2022-June/024203.html
+
+See also:
+https://wiki.gentoo.org/wiki/User:Sam/Musl_porting_notes#error:_assignment_of_read-only_variable_.27.5Bstdout.7Cstdin.7Cstderr.5D.27
+https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html
+
+---
+ lib/log/log.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/log/log.c b/lib/log/log.c
+index 7b4d537..897c183 100644
+--- a/lib/log/log.c
++++ b/lib/log/log.c
+@@ -207,8 +207,12 @@ int reopen_standard_stream(FILE **stream, const char *mode)
+ }
+
+ _check_and_replace_standard_log_streams(old_stream, new_stream);
+-
++
++#ifdef __GLIBC__
+ *stream = new_stream;
++#else
++ freopen(NULL, mode, *stream);
++#endif
+ return 1;
+ }
+
+--
+2.35.1
+
diff --git a/sys-fs/lvm2/lvm2-2.03.14-r2.ebuild b/sys-fs/lvm2/lvm2-2.03.14-r3.ebuild
index 2da81764efe4..281599b2fdf0 100644
--- a/sys-fs/lvm2/lvm2-2.03.14-r2.ebuild
+++ b/sys-fs/lvm2/lvm2-2.03.14-r3.ebuild
@@ -73,6 +73,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.03.14-r1-add-fcntl.patch
"${FILESDIR}"/${PN}-2.03.14-r1-fopen-to-freopen.patch
"${FILESDIR}"/${PN}-2.03.14-r1-mallinfo.patch
+ "${FILESDIR}"/${PN}-2.03.14-freopen_n2.patch
)
pkg_setup() {