diff --git a/pkgs/os-specific/linux/lvm2/2_02.nix b/pkgs/os-specific/linux/lvm2/2_02.nix deleted file mode 100644 index 07d8de0b2270..000000000000 --- a/pkgs/os-specific/linux/lvm2/2_02.nix +++ /dev/null @@ -1,4 +0,0 @@ -import ./common.nix { - version = "2.02.188"; - hash = "sha256-cQHosIFq135DkP7ZdJoJAhS6UgBhzQg0N4ceGeUMyb0="; -} diff --git a/pkgs/os-specific/linux/lvm2/2_03.nix b/pkgs/os-specific/linux/lvm2/2_03.nix index 5a5193997be0..0237a0555abb 100644 --- a/pkgs/os-specific/linux/lvm2/2_03.nix +++ b/pkgs/os-specific/linux/lvm2/2_03.nix @@ -1,4 +1,4 @@ import ./common.nix { - version = "2.03.18"; - hash = "sha256-n2g+KYDZXA3Ou9JcfBdwMsVhXXJnv8iF6r/OWSgPR2k="; + version = "2.03.19"; + hash = "sha256-7J/58dmYzisF8a0i3c+UAdIC0CFYEdxGjXjLprCyaHk="; } diff --git a/pkgs/os-specific/linux/lvm2/common.nix b/pkgs/os-specific/linux/lvm2/common.nix index 0ea8a97bdb2e..27a160033b11 100644 --- a/pkgs/os-specific/linux/lvm2/common.nix +++ b/pkgs/os-specific/linux/lvm2/common.nix @@ -1,7 +1,6 @@ { version, hash }: { lib, stdenv -, fetchpatch , fetchurl , pkg-config , coreutils @@ -52,6 +51,7 @@ stdenv.mkDerivation rec { "--with-default-locking-dir=/run/lock/lvm" "--with-default-run-dir=/run/lvm" "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + "--with-systemd-run=/run/current-system/systemd/bin/systemd-run" ] ++ lib.optionals (!enableCmdlib) [ "--bindir=${placeholder "bin"}/bin" "--sbindir=${placeholder "bin"}/bin" @@ -68,28 +68,17 @@ stdenv.mkDerivation rec { ] ++ lib.optionals udevSupport [ "--enable-udev_rules" "--enable-udev_sync" + ] ++ lib.optionals enableVDO [ + "--enable-vdo" ] ++ lib.optionals stdenv.hostPlatform.isStatic [ "--enable-static_link" - ] ++ lib.optionals enableVDO [ - "--enable-vdo" ]; preConfigure = '' sed -i /DEFAULT_SYS_DIR/d Makefile.in sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in - '' + lib.optionalString (lib.versionOlder version "2.03.15") '' - substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \ - --replace /usr/bin/udevadm /run/current-system/systemd/bin/udevadm - # https://github.com/lvmteam/lvm2/issues/36 - '' + lib.optionalString (lib.versionOlder version "2.03.14") '' - substituteInPlace udev/69-dm-lvm-metad.rules.in \ - --replace "(BINDIR)/systemd-run" /run/current-system/systemd/bin/systemd-run - '' + lib.optionalString (lib.versionAtLeast version "2.03.14") '' - substituteInPlace udev/69-dm-lvm.rules.in \ - --replace "/usr/bin/systemd-run" /run/current-system/systemd/bin/systemd-run - '' + '' + substituteInPlace make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system" - '' + lib.optionalString (lib.versionAtLeast version "2.03") '' substituteInPlace libdm/make.tmpl.in --replace "@systemdsystemunitdir@" "$out/lib/systemd/system" substituteInPlace scripts/blk_availability_systemd_red_hat.service.in \ @@ -100,9 +89,8 @@ stdenv.mkDerivation rec { sed -i 's|^#define LVM_CONFIGURE_LINE.*$|#define LVM_CONFIGURE_LINE ""|g' ./include/configure.h ''; - patches = lib.optionals (lib.versionAtLeast version "2.03.15") [ + patches = [ # fixes paths to and checks for tools - # TODO: needs backport to LVM 2.02 used by static/musl (substituteAll (let optionalTool = cond: pkg: if cond then pkg else "/run/current-system/sw"; in { @@ -113,22 +101,16 @@ stdenv.mkDerivation rec { multipath_tools = optionalTool enableMultipath multipath-tools; vdo = optionalTool enableVDO vdo; })) - ] ++ lib.optionals (lib.versionOlder version "2.03.15") [ - # Musl fixes from Alpine. + # Musl fix from Alpine ./fix-stdio-usage.patch - (fetchpatch { - name = "mallinfo.patch"; - url = "https://git.alpinelinux.org/aports/plain/main/lvm2/mallinfo.patch?h=3.7-stable&id=31bd4a8c2dc00ae79a821f6fe0ad2f23e1534f50"; - sha256 = "0g6wlqi215i5s30bnbkn8w7axrs27y3bnygbpbnf64wwx7rxxlj0"; - }) ] ++ lib.optionals stdenv.hostPlatform.isStatic [ - ./no-shared.diff + ./no-shared.patch ]; doCheck = false; # requires root makeFlags = lib.optionals udevSupport [ - "SYSTEMD_GENERATOR_DIR=$(out)/lib/systemd/system-generators" + "SYSTEMD_GENERATOR_DIR=${placeholder "out"}/lib/systemd/system-generators" ] ++ lib.optionals onlyLib [ "libdm.device-mapper" ]; @@ -164,7 +146,10 @@ stdenv.mkDerivation rec { moveToOutput lib/libdevmapper.so $lib ''; - passthru.tests.installer = nixosTests.installer.lvm; + passthru.tests = { + installer = nixosTests.installer.lvm; + lvm2 = nixosTests.lvm2; + }; meta = with lib; { homepage = "http://sourceware.org/lvm2/"; diff --git a/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch b/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch index 59666ffbad5a..98cdc6eb3ec9 100644 --- a/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch +++ b/pkgs/os-specific/linux/lvm2/fix-stdio-usage.patch @@ -1,8 +1,18 @@ +From 63b1c7332bee6080bffecf9ce9d75ff15d799166 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 16 Nov 2022 10:42:39 +0100 +Subject: [PATCH] fix stdio usage + +--- + lib/commands/toolcontext.c | 4 ++-- + tools/lvmcmdline.c | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c -index 296618686..96343eeb7 100644 +index b630554a9..f20080d18 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c -@@ -1619,7 +1619,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd, +@@ -1667,7 +1667,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd, /* FIXME Make this configurable? */ reset_lvm_errno(1); @@ -11,20 +21,20 @@ index 296618686..96343eeb7 100644 /* Set in/out stream buffering before glibc */ if (set_buffering #ifdef SYS_gettid -@@ -2006,7 +2006,7 @@ void destroy_toolcontext(struct cmd_context *cmd) +@@ -2045,7 +2045,7 @@ void destroy_toolcontext(struct cmd_context *cmd) + dm_hash_destroy(cmd->cft_def_hash); - if (cmd->pending_delete_mem) - dm_pool_destroy(cmd->pending_delete_mem); + dm_device_list_destroy(&cmd->cache_dm_devs); -#ifndef VALGRIND_POOL +#if !defined(VALGRIND_POOL) && defined(__GLIBC__) if (cmd->linebuffer) { /* Reset stream buffering to defaults */ if (is_valid_fd(STDIN_FILENO) && diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c -index d97ff5720..bbbda82bd 100644 +index a5bb6a5c5..0ebfa375c 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c -@@ -3342,7 +3342,7 @@ static int _check_standard_fds(void) +@@ -3422,7 +3422,7 @@ static int _check_standard_fds(void) int err = is_valid_fd(STDERR_FILENO); if (!is_valid_fd(STDIN_FILENO) && @@ -33,7 +43,7 @@ index d97ff5720..bbbda82bd 100644 if (err) perror("stdin stream open"); else -@@ -3352,7 +3352,7 @@ static int _check_standard_fds(void) +@@ -3432,7 +3432,7 @@ static int _check_standard_fds(void) } if (!is_valid_fd(STDOUT_FILENO) && @@ -42,7 +52,7 @@ index d97ff5720..bbbda82bd 100644 if (err) perror("stdout stream open"); /* else no stdout */ -@@ -3360,7 +3360,7 @@ static int _check_standard_fds(void) +@@ -3440,7 +3440,7 @@ static int _check_standard_fds(void) } if (!is_valid_fd(STDERR_FILENO) && @@ -51,3 +61,6 @@ index d97ff5720..bbbda82bd 100644 printf("stderr stream open: %s\n", strerror(errno)); return 0; +-- +2.38.1 + diff --git a/pkgs/os-specific/linux/lvm2/no-shared.diff b/pkgs/os-specific/linux/lvm2/no-shared.diff deleted file mode 100644 index d40dd85dfc62..000000000000 --- a/pkgs/os-specific/linux/lvm2/no-shared.diff +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/libdm/Makefile.in b/libdm/Makefile.in -index 66ec39513..ab7123dae 100644 ---- a/libdm/Makefile.in -+++ b/libdm/Makefile.in -@@ -44,7 +44,6 @@ endif - - LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX) - LIB_VERSION = $(LIB_VERSION_DM) --TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION) - - CFLOW_LIST = $(SOURCES) - CFLOW_LIST_TARGET = libdevmapper.cflow -diff --git a/make.tmpl.in b/make.tmpl.in -index e7780e8d4..ca4aa9fdd 100644 ---- a/make.tmpl.in -+++ b/make.tmpl.in -@@ -346,7 +346,7 @@ SUBDIRS.cflow := $(SUBDIRS:=.cflow) - SUBDIRS.clean := $(SUBDIRS:=.clean) - SUBDIRS.distclean := $(SUBDIRS:=.distclean) - --TARGETS += $(LIB_SHARED) $(LIB_STATIC) -+TARGETS += $(LIB_STATIC) - - all: $(SUBDIRS) $(TARGETS) - diff --git a/pkgs/os-specific/linux/lvm2/no-shared.patch b/pkgs/os-specific/linux/lvm2/no-shared.patch new file mode 100644 index 000000000000..23a82a0fa294 --- /dev/null +++ b/pkgs/os-specific/linux/lvm2/no-shared.patch @@ -0,0 +1,46 @@ +diff --git a/libdm/Makefile.in b/libdm/Makefile.in +index 2758648e6..f305a12b0 100644 +--- a/libdm/Makefile.in ++++ b/libdm/Makefile.in +@@ -47,7 +47,6 @@ endif + + LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX) + LIB_VERSION = $(LIB_VERSION_DM) +-TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION) .symver_check + + CFLOW_LIST = $(SOURCES) + CFLOW_LIST_TARGET = libdevmapper.cflow +diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in +index a731687c2..9366cdf1c 100644 +--- a/libdm/make.tmpl.in ++++ b/libdm/make.tmpl.in +@@ -314,7 +314,7 @@ SUBDIRS.cflow := $(SUBDIRS:=.cflow) + SUBDIRS.clean := $(SUBDIRS:=.clean) + SUBDIRS.distclean := $(SUBDIRS:=.distclean) + +-TARGETS += $(LIB_SHARED) $(LIB_STATIC) ++TARGETS += $(LIB_STATIC) + + all: $(SUBDIRS) $(TARGETS) + +@@ -431,7 +431,6 @@ DEFS+=-D_FILE_OFFSET_BITS=64 + + ifneq (,$(LIB_SHARED)) + +-TARGETS += $(LIB_SHARED).$(LIB_VERSION) + $(LIB_SHARED).$(LIB_VERSION): $(OBJECTS) $(LDDEPS) + @echo " [CC] $@" + ifeq ("@LIB_SUFFIX@","so") +diff --git a/make.tmpl.in b/make.tmpl.in +index b73176f5a..6100d0dfd 100644 +--- a/make.tmpl.in ++++ b/make.tmpl.in +@@ -368,7 +368,7 @@ SUBDIRS.cflow := $(SUBDIRS:=.cflow) + SUBDIRS.clean := $(SUBDIRS:=.clean) + SUBDIRS.distclean := $(SUBDIRS:=.distclean) + +-TARGETS += $(LIB_SHARED) $(LIB_STATIC) ++TARGETS += $(LIB_STATIC) + + INTERNAL_LIBS = \ + $(top_builddir)/libdaemon/client/libdaemonclient.a \ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 18bbc59113fc..2719b063db6c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26265,7 +26265,7 @@ with pkgs; lsscsi = callPackage ../os-specific/linux/lsscsi { }; - lvm2-2_03 = callPackage ../os-specific/linux/lvm2/2_03.nix { + lvm2 = callPackage ../os-specific/linux/lvm2/2_03.nix { # udev is the same package as systemd which depends on cryptsetup # which depends on lvm2 again. But we only need the libudev part # which does not depend on cryptsetup. @@ -26275,10 +26275,6 @@ with pkgs; # systemd (optionally, but on by default) on cryptsetup and cryptsetup depends on lvm2 util-linux = util-linuxMinimal; }; - lvm2-2_02 = callPackage ../os-specific/linux/lvm2/2_02.nix { - udev = systemdMinimal; - }; - lvm2 = if stdenv.hostPlatform.isMusl then lvm2-2_02 else lvm2-2_03; lvm2_dmeventd = lvm2.override { enableDmeventd = true;