diff --git a/pkgs/by-name/ut/util-linux/include-correct-struct-statfs-header.patch b/pkgs/by-name/ut/util-linux/include-correct-struct-statfs-header.patch new file mode 100644 index 000000000000..6787ef311abf --- /dev/null +++ b/pkgs/by-name/ut/util-linux/include-correct-struct-statfs-header.patch @@ -0,0 +1,61 @@ +From 145b6a66dcc725de3c3161db62db7047eb407214 Mon Sep 17 00:00:00 2001 +From: Morgan Jones +Date: Sun, 5 Apr 2026 18:03:54 -0700 +Subject: [PATCH] pidfd-utils: include correct struct statfs header for darwin + +Fixes the build on Darwin since struct statfs is in sys/mount.h +and sys/vfs.h doesn't even exist. Just conditionally include all the +headers. +--- + include/statfs_magic.h | 16 ++++++++++++++++ + lib/pidfd-utils.c | 3 --- + 2 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/include/statfs_magic.h b/include/statfs_magic.h +index 6921abaa4..28977f392 100644 +--- a/include/statfs_magic.h ++++ b/include/statfs_magic.h +@@ -5,10 +5,26 @@ + #ifndef UTIL_LINUX_STATFS_MAGIC_H + #define UTIL_LINUX_STATFS_MAGIC_H + ++#ifdef HAVE_SYS_TYPES_H ++# include ++#endif ++ ++#ifdef HAVE_SYS_STAT_H ++# include ++#endif ++ + #ifdef HAVE_SYS_STATFS_H + # include + #endif + ++#ifdef HAVE_SYS_VFS_H ++# include ++#endif ++ ++#ifdef HAVE_SYS_MOUNT_H ++# include ++#endif ++ + /* + * If possible then don't depend on internal libc __SWORD_TYPE type. + */ +diff --git a/lib/pidfd-utils.c b/lib/pidfd-utils.c +index a83735920..f7c649144 100644 +--- a/lib/pidfd-utils.c ++++ b/lib/pidfd-utils.c +@@ -5,9 +5,6 @@ + * Authors: Christian Goeschel Ndjomouo [2025] + */ + #include +-#include +-#include +-#include + #include + #include + +-- +2.50.1 + diff --git a/pkgs/by-name/ut/util-linux/package.nix b/pkgs/by-name/ut/util-linux/package.nix index 95f68397d57c..aef6ace7f00b 100644 --- a/pkgs/by-name/ut/util-linux/package.nix +++ b/pkgs/by-name/ut/util-linux/package.nix @@ -43,11 +43,11 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "util-linux" + lib.optionalString isMinimal "-minimal"; - version = "2.41.3"; + version = "2.42"; src = fetchurl { url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor finalAttrs.version}/util-linux-${finalAttrs.version}.tar.xz"; - hash = "sha256-MzDYc/D861VguJp9wU5PMoi72IDpaQPtm1DsK1eZ5Ys="; + hash = "sha256-NFKyYLuqd11udJrDuyIRF4UAP8H0RJcAJcjaJt+nWOk="; }; patches = [ @@ -56,17 +56,9 @@ stdenv.mkDerivation (finalAttrs: { # distros anyway). ./rtcwake-search-PATH-for-shutdown.patch - # pam_lastlog2: link with libpam - # see https://github.com/NixOS/nixpkgs/issues/493934 - ./pam_lastlog2-add-lpam-to-Makemodule.am.patch - - # bits: only build when cpu_set_t is available - # Otherwise, the build fails on macOS - (fetchurl { - name = "bits-only-build-when-cpu_set_t-is-available.patch"; - url = "https://lore.kernel.org/util-linux/20250501075806.88759-1-hi@alyssa.is/raw"; - hash = "sha256-G7Cdv8636wJEjgt9am7PaDI8bpSF8sO9bFWEIiAL25A="; - }) + # Fix compile of 2.42+ on Darwin. + # https://lore.kernel.org/util-linux/CAEUYr6ZjVX1bd-xcBGtFN_ZYwQnXDYsw7d1-7sTpF2BbgfrR+g@mail.gmail.com/T/#u + ./include-correct-struct-statfs-header.patch ]; # We separate some of the utilities into their own outputs. This @@ -221,13 +213,6 @@ stdenv.mkDerivation (finalAttrs: { doCheck = false; # "For development purpose only. Don't execute on production system!" passthru = { - updateScript = gitUpdater { - # No nicer place to find latest release. - url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"; - rev-prefix = "v"; - ignoredVersions = "(-rc).*"; - }; - # encode upstream assumption to be used in man-db # https://github.com/util-linux/util-linux/commit/8886d84e25a457702b45194d69a47313f76dc6bc hasCol = stdenv.hostPlatform.libc == "glibc"; @@ -235,6 +220,14 @@ stdenv.mkDerivation (finalAttrs: { tests = { inherit (nixosTests) pam-lastlog; }; + } + // lib.optionalAttrs (!isMinimal) { + updateScript = gitUpdater { + # No nicer place to find latest release. + url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"; + rev-prefix = "v"; + ignoredVersions = "(-rc|-start|-devel).*"; + }; }; meta = { diff --git a/pkgs/by-name/ut/util-linux/pam_lastlog2-add-lpam-to-Makemodule.am.patch b/pkgs/by-name/ut/util-linux/pam_lastlog2-add-lpam-to-Makemodule.am.patch deleted file mode 100644 index 3ffb12387bb6..000000000000 --- a/pkgs/by-name/ut/util-linux/pam_lastlog2-add-lpam-to-Makemodule.am.patch +++ /dev/null @@ -1,52 +0,0 @@ -From c8e620c6bcd044786c59f822810fc973090dbfa2 Mon Sep 17 00:00:00 2001 -From: Morgan Jones -Date: Mon, 2 Mar 2026 11:03:39 -0800 -Subject: [PATCH] pam_lastlog2: add -lpam to Makemodule.am - -If we don't add this, we don't actually link with PAM; compare the -before and after of `lib/security/pam_lastlog2.so`. - -``` -Dynamic section at offset 0x2ce8 contains 31 entries: - Tag Type Name/Value - 0x0000000000000001 (NEEDED) Shared library: [liblastlog2.so.2] - 0x0000000000000001 (NEEDED) Shared library: [libsqlite3.so] - 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] - 0x000000000000000e (SONAME) Library soname: [pam_lastlog2.so] -``` - -``` -Dynamic section at offset 0x2cd8 contains 32 entries: - Tag Type Name/Value - 0x0000000000000001 (NEEDED) Shared library: [libpam.so.0] - 0x0000000000000001 (NEEDED) Shared library: [liblastlog2.so.2] - 0x0000000000000001 (NEEDED) Shared library: [libsqlite3.so] - 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] - 0x000000000000000e (SONAME) Library soname: [pam_lastlog2.so] -``` - -This causes issues like https://github.com/NixOS/nixpkgs/issues/493934 -where the library has trouble linking with PAM symbols because it is not -linked. - -Signed-off-by: Morgan Jones ---- - pam_lastlog2/src/Makemodule.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/pam_lastlog2/src/Makemodule.am b/pam_lastlog2/src/Makemodule.am -index 40d597c58..629930853 100644 ---- a/pam_lastlog2/src/Makemodule.am -+++ b/pam_lastlog2/src/Makemodule.am -@@ -13,7 +13,7 @@ pam_lastlog2_la_CFLAGS = \ - - pam_lastlog2_la_LIBADD = liblastlog2.la - --pam_lastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS) -module -avoid-version -shared -+pam_lastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS) -lpam -module -avoid-version -shared - if HAVE_VSCRIPT - pam_lastlog2_la_LDFLAGS += $(VSCRIPT_LDFLAGS),$(top_srcdir)/pam_lastlog2/src/pam_lastlog2.sym - endif --- -2.50.1 -