From 90535adc89a8af18427a9eb9d603a4c86eb7b540 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 6 Aug 2026 16:50:02 +0900 Subject: [PATCH] internal/rosa/package: lvm2 This is only really packaged for devmapper, and will eventually be replaced by a native implementation. Signed-off-by: Ophestra --- .../rosa/package/lvm2/fix-stdio-usage.patch | 67 +++++++++++++++++++ internal/rosa/package/lvm2/package.az | 28 ++++++++ internal/rosa/package/lvm2/remove-man.patch | 13 ++++ 3 files changed, 108 insertions(+) create mode 100644 internal/rosa/package/lvm2/fix-stdio-usage.patch create mode 100644 internal/rosa/package/lvm2/package.az create mode 100644 internal/rosa/package/lvm2/remove-man.patch diff --git a/internal/rosa/package/lvm2/fix-stdio-usage.patch b/internal/rosa/package/lvm2/fix-stdio-usage.patch new file mode 100644 index 00000000..103618c4 --- /dev/null +++ b/internal/rosa/package/lvm2/fix-stdio-usage.patch @@ -0,0 +1,67 @@ +diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c +index 60739af..8b3fdf7 100644 +--- a/lib/commands/toolcontext.c ++++ b/lib/commands/toolcontext.c +@@ -1661,6 +1661,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd, + reset_lvm_errno(1); + + /* Set in/out stream buffering before glibc */ ++#ifdef __GLIBC__ + if (set_buffering + && !cmd->running_on_valgrind /* Skipping within valgrind execution. */ + #ifdef SYS_gettid +@@ -1704,6 +1705,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd, + } else if (!set_buffering) + /* Without buffering, must not use stdin/stdout */ + init_silent(1); ++#endif + + /* + * Environment variable LVM_SYSTEM_DIR overrides this below. +@@ -2038,6 +2040,7 @@ void destroy_toolcontext(struct cmd_context *cmd) + if (cmd->cft_def_hash) + dm_hash_destroy(cmd->cft_def_hash); + ++#ifdef __GLIBC__ + if (!cmd->running_on_valgrind && cmd->linebuffer) { + int flags; + /* Reset stream buffering to defaults */ +@@ -2061,6 +2064,7 @@ void destroy_toolcontext(struct cmd_context *cmd) + + free(cmd->linebuffer); + } ++#endif + + destroy_config_context(cmd); + +diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c +index 7209ebd..778c8c0 100644 +--- a/tools/lvmcmdline.c ++++ b/tools/lvmcmdline.c +@@ -3378,7 +3378,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 +@@ -3388,7 +3388,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 */ +@@ -3396,7 +3396,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; diff --git a/internal/rosa/package/lvm2/package.az b/internal/rosa/package/lvm2/package.az new file mode 100644 index 00000000..0f63e80d --- /dev/null +++ b/internal/rosa/package/lvm2/package.az @@ -0,0 +1,28 @@ +package lvm2 { + description = "userspace toolset that provide logical volume management facilities"; + website = "https://sourceware.org/lvm2"; + anitya = 5354; + + version# = "2.03.41"; + source = remoteTar { + url = "https://mirrors.kernel.org/sourceware/lvm2/releases/LVM2."+version+".tgz"; + compress = gzip; + checksum = "M3L0oaeEG-0FvL7gYoeLwWIm-RBtKa4-ojwezRqL8xqiyU_5N7uE2bvwTeVJ154z"; + }; + patches = [ + "fix-stdio-usage.patch", + "remove-man.patch", + ]; + + exec = make { + // requires root + skipCheck = true; + }; + + inputs = [ + pkg-config, + + libaio, + kernel-headers, + ]; +} diff --git a/internal/rosa/package/lvm2/remove-man.patch b/internal/rosa/package/lvm2/remove-man.patch new file mode 100644 index 00000000..c9629234 --- /dev/null +++ b/internal/rosa/package/lvm2/remove-man.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index bf011ff4f..86713f2cd 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -18,7 +18,7 @@ top_builddir = @top_builddir@ + abs_top_builddir = @abs_top_builddir@ + abs_top_srcdir = @abs_top_srcdir@ + +-SUBDIRS = libdm conf daemons include lib libdaemon man scripts tools ++SUBDIRS = libdm conf daemons include lib libdaemon scripts tools + + ifeq ("@UDEV_RULES@", "yes") + SUBDIRS += udev