public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/, sys-fs/lvm2/files/
Date: Thu, 16 Jun 2022 22:10:41 +0000 (UTC)	[thread overview]
Message-ID: <1655417426.515ec4557c56cf0e82b95873056c40d8c6269694.sam@gentoo> (raw)

commit:     515ec4557c56cf0e82b95873056c40d8c6269694
Author:     Alfred Persson Forsberg <cat <AT> catcream <DOT> org>
AuthorDate: Thu Jun 16 22:03:41 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 16 22:10:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=515ec455

sys-fs/lvm2: fix building on musl

A few changes to make lvm2 build on musl. Each patch file is commented
in more detail, see those. The mallinfo patch should be looked back to.

Closes: https://bugs.gentoo.org/712336
Closes: https://bugs.gentoo.org/549506
Signed-off-by: Alfred Persson Forsberg <cat <AT> catcream.org>
Closes: https://github.com/gentoo/gentoo/pull/25883
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/lvm2/files/lvm2-2.03.14-r1-add-fcntl.patch  | 24 ++++++++++++
 .../files/lvm2-2.03.14-r1-fopen-to-freopen.patch   | 43 ++++++++++++++++++++++
 sys-fs/lvm2/files/lvm2-2.03.14-r1-mallinfo.patch   | 18 +++++++++
 sys-fs/lvm2/lvm2-2.03.14-r1.ebuild                 |  3 ++
 4 files changed, 88 insertions(+)

diff --git a/sys-fs/lvm2/files/lvm2-2.03.14-r1-add-fcntl.patch b/sys-fs/lvm2/files/lvm2-2.03.14-r1-add-fcntl.patch
new file mode 100644
index 000000000000..1b5524a61405
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.03.14-r1-add-fcntl.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/712336
+https://bugs.gentoo.org/549506
+
+Adds fcntl.h into daemon-server.c to define fcntl and some constants.
+
+---
+ libdaemon/server/daemon-server.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
+index 88905a7..771b021 100644
+--- a/libdaemon/server/daemon-server.c
++++ b/libdaemon/server/daemon-server.c
+@@ -28,6 +28,7 @@
+ #include <sys/un.h>
+ #include <unistd.h>
+ #include <signal.h>
++#include <fcntl.h>
+ 
+ #include <syslog.h> /* FIXME. For the global closelog(). */
+ 
+-- 
+2.35.1
+

diff --git a/sys-fs/lvm2/files/lvm2-2.03.14-r1-fopen-to-freopen.patch b/sys-fs/lvm2/files/lvm2-2.03.14-r1-fopen-to-freopen.patch
new file mode 100644
index 000000000000..56248e10e5d6
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.03.14-r1-fopen-to-freopen.patch
@@ -0,0 +1,43 @@
+In musl stdout, stdin and stderr are read-only unlike in glibc.
+This patch changes std* = fopen(...) to freopen(..., std*).
+
+See: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html and https://wiki.gentoo.org/wiki/User:Sam/Musl_porting_notes
+
+---
+ tools/lvmcmdline.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
+index 1e12bed..19da1e5 100644
+--- a/tools/lvmcmdline.c
++++ b/tools/lvmcmdline.c
+@@ -3384,7 +3384,7 @@ static int _check_standard_fds(void)
+ 	int err = is_valid_fd(STDERR_FILENO);
+ 
+ 	if (!is_valid_fd(STDIN_FILENO) &&
+-	    !(stdin = fopen(_PATH_DEVNULL, "r"))) {
++		!freopen(_PATH_DEVNULL, "r", stdin)) {
+ 		if (err)
+ 			perror("stdin stream open");
+ 		else
+@@ -3394,7 +3394,7 @@ static int _check_standard_fds(void)
+ 	}
+ 
+ 	if (!is_valid_fd(STDOUT_FILENO) &&
+-	    !(stdout = fopen(_PATH_DEVNULL, "w"))) {
++		!freopen(_PATH_DEVNULL, "w", stdout)) {
+ 		if (err)
+ 			perror("stdout stream open");
+ 		/* else no stdout */
+@@ -3402,7 +3402,7 @@ static int _check_standard_fds(void)
+ 	}
+ 
+ 	if (!is_valid_fd(STDERR_FILENO) &&
+-	    !(stderr = fopen(_PATH_DEVNULL, "w"))) {
++		!freopen(_PATH_DEVNULL, "w", stderr)) {
+ 		printf("stderr stream open: %s\n",
+ 		       strerror(errno));
+ 		return 0;
+-- 
+2.35.1
+

diff --git a/sys-fs/lvm2/files/lvm2-2.03.14-r1-mallinfo.patch b/sys-fs/lvm2/files/lvm2-2.03.14-r1-mallinfo.patch
new file mode 100644
index 000000000000..af4cbc0d5aab
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.03.14-r1-mallinfo.patch
@@ -0,0 +1,18 @@
+https://git.alpinelinux.org/aports/tree/main/lvm2/mallinfo.patch
+
+Patch from Alpine, disables _allocate_memory since mallinfo isn't defined in musl.
+19:17 <@sam_> your caution is well-advised, but it should be safe enough given it's only affecting the non-glibc path
+
+Should be looked back to!
+
+--- ./lib/mm/memlock.c.orig	2015-03-09 11:18:41.560028850 -0100
++++ ./lib/mm/memlock.c	2015-03-09 11:19:54.504373309 -0100
+@@ -137,7 +137,7 @@
+ 
+ static void _allocate_memory(void)
+ {
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	void *stack_mem;
+ 	struct rlimit limit;
+ 	int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;

diff --git a/sys-fs/lvm2/lvm2-2.03.14-r1.ebuild b/sys-fs/lvm2/lvm2-2.03.14-r1.ebuild
index f3bc54eebc36..66b2184868ed 100644
--- a/sys-fs/lvm2/lvm2-2.03.14-r1.ebuild
+++ b/sys-fs/lvm2/lvm2-2.03.14-r1.ebuild
@@ -70,6 +70,9 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-2.03.05-dmeventd-no-idle-exit.patch
 	#"${FILESDIR}"/${PN}-2.02.184-allow-reading-metadata-with-invalid-creation_time.patch #682380 # merged upstream
 	"${FILESDIR}"/${PN}-2.02.184-mksh_build.patch #686652
+	"${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
 )
 
 pkg_setup() {


             reply	other threads:[~2022-06-16 22:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 22:10 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-02 15:21 [gentoo-commits] repo/gentoo:master commit in: sys-fs/lvm2/, sys-fs/lvm2/files/ Mike Gilbert
2023-06-02 13:02 David Seifert
2023-05-10  8:57 David Seifert
2023-05-10  8:57 David Seifert
2023-04-13 11:10 David Seifert
2023-02-21 20:29 David Seifert
2023-01-28 13:38 David Seifert
2023-01-13 11:11 David Seifert
2022-11-19 21:05 David Seifert
2022-11-18 17:59 Sam James
2022-10-27 17:13 Robin H. Johnson
2022-10-26 19:17 Mike Gilbert
2022-07-07 15:10 Mike Gilbert
2021-05-09  9:05 Lars Wendler
2020-03-26 20:24 Lars Wendler
2019-11-28 22:45 Robin H. Johnson
2019-11-27 16:16 Lars Wendler
2019-07-24  9:54 Lars Wendler
2019-06-18  9:03 Lars Wendler
2019-06-18  5:27 Robin H. Johnson
2019-05-07 19:16 Robin H. Johnson
2019-04-17  7:26 Robin H. Johnson
2016-04-20  3:58 Mike Frysinger
2016-04-02  5:07 Mike Frysinger
2016-03-09 20:12 Robin H. Johnson
2016-01-25  2:40 Marc Schiffbauer
2015-12-28  0:30 Robin H. Johnson
2015-12-03 11:33 Lars Wendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1655417426.515ec4557c56cf0e82b95873056c40d8c6269694.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox