commit: 2caf954f31dcdd8de32f7fa6f6400cbeeaeebcb4 Author: orbea <orbea <AT> riseup <DOT> net> AuthorDate: Sun Nov 24 15:33:09 2024 +0000 Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org> CommitDate: Mon Nov 25 17:17:56 2024 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2caf954f
patches/lvm: add missing musl patches Gentoo-Issue: https://bugs.gentoo.org/934773 Signed-off-by: orbea <orbea <AT> riseup.net> Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org> patches/lvm/2.03.22/lvm2-019-musl-basename.patch | 34 +++++++++++++++ patches/lvm/2.03.22/lvm2-020-freopen-musl.patch | 54 ++++++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/patches/lvm/2.03.22/lvm2-019-musl-basename.patch b/patches/lvm/2.03.22/lvm2-019-musl-basename.patch new file mode 100644 index 00000000..2dd9f8ff --- /dev/null +++ b/patches/lvm/2.03.22/lvm2-019-musl-basename.patch @@ -0,0 +1,34 @@ +https://bugs.gentoo.org/937239 +https://github.com/lvmteam/lvm2/commit/f98d2ffe8753895c84160a7abce4223bd127cd9e + +From f98d2ffe8753895c84160a7abce4223bd127cd9e Mon Sep 17 00:00:00 2001 +From: Zdenek Kabelac <[email protected]> +Date: Wed, 27 Mar 2024 00:28:14 +0100 +Subject: [PATCH] device_id: use dm_basename + +Avoid problems for other libc like muslc and use dm_basename. + +Prototype for basename has been removed from string.h from latest musl [1] +compilers e.g. clang-18 flags the absense of prototype as error. therefore +include libgen.h for providing it. + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 + +Reported-by: Khem Raj <[email protected]> +--- + lib/device/device_id.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/device/device_id.c b/lib/device/device_id.c +index 7d67a1cb7..200d39432 100644 +--- a/lib/device/device_id.c ++++ b/lib/device/device_id.c +@@ -740,7 +740,7 @@ static int _dev_read_sys_serial(struct cmd_context *cmd, struct device *dev, + int ret; + + /* /dev/vda to vda */ +- base = basename(devname); ++ base = dm_basename(devname); + + /* vda1 to vda */ + for (i = 0; i < strlen(base); i++) { diff --git a/patches/lvm/2.03.22/lvm2-020-freopen-musl.patch b/patches/lvm/2.03.22/lvm2-020-freopen-musl.patch new file mode 100644 index 00000000..2b3f0a91 --- /dev/null +++ b/patches/lvm/2.03.22/lvm2-020-freopen-musl.patch @@ -0,0 +1,54 @@ +From 4cf08811e112100a2b10c60047f3c537ad21d674 Mon Sep 17 00:00:00 2001 +From: David Seifert <[email protected]> +Date: Sat, 28 Jan 2023 14:22:42 +0100 +Subject: [PATCH] Use `freopen()` on {stdin,stdout,stderr} + +* ISO C does not guarantee that the standard streams are modifiable + lvalues. Glibc even calls out this behaviour as non-portable: + https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html +--- a/lib/log/log.c ++++ b/lib/log/log.c +@@ -208,7 +208,11 @@ 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; + } + +--- a/tools/lvmcmdline.c ++++ b/tools/lvmcmdline.c +@@ -3422,7 +3422,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 +@@ -3432,7 +3432,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 */ +@@ -3440,7 +3440,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.39.2 +
