Subject: [PATCH core-packages-team] gnu: util-linux: Update to 2.40.4.
From: Zheng Junjie <[email-masked]>
To: [email-masked]
Date: Thu, 27 Feb 2025 01:06:43 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/linux.scm (util-linux)[source]<snippet>: Remove tailing #t.
[arguments]<#:phases>: Adjust pre-check phase.
[inputs]: Add sqlite.
[native-inputs]: Add pkg-config.
* gnu/packages/patches/util-linux-tests.patch: Adjust it.

Change-Id: I3c22d0b5b02a6dd0fee440f32e87279d7d4b1554
---
 gnu/packages/linux.scm                      | 21 ++++++++++++++-------
 gnu/packages/patches/util-linux-tests.patch | 19 +------------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 8b00026f2ea..47621b13684 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -73,7 +73,7 @@
 ;;; Copyright © 2022, 2023 Demis Balbach <[email-masked]>
 ;;; Copyright © 2023 Bruno Victal <[email-masked]>
 ;;; Copyright © 2023 Yovan Naumovski <[email-masked]>
-;;; Copyright © 2023 Zheng Junjie <[email-masked]>
+;;; Copyright © 2023, 2025 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2023 dan <[email-masked]>
 ;;; Copyright © 2023 Foundation Devices, Inc. <[email-masked]>
 ;;; Copyright © 2023, 2024 Wilko Meyer <[email-masked]>
@@ -2338,7 +2338,7 @@ (define-public psmisc
 (define-public util-linux
   (package
     (name "util-linux")
-    (version "2.37.4")
+    (version "2.40.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://kernel.org/linux/utils/"
@@ -2346,7 +2346,7 @@ (define-public util-linux
                                   "util-linux-" version ".tar.xz"))
               (sha256
                (base32
-                "10svcnsqmrsd660bzcm7k6dm8sa7hkknhr3bag1nccwimlb6jkk3"))
+                "0ygvflcr7v7x2rmr9h5mi07yx00i9368ggf3znd8bs847drsy7aw"))
               (patches (search-patches "util-linux-tests.patch"))
               (modules '((guix build utils)))
               (snippet
@@ -2356,8 +2356,7 @@ (define-public util-linux
                   (substitute* "configure"
                     (("build_nologin=yes") "build_nologin=no")
                     (("build_logger=yes") "build_logger=no")
-                    (("build_kill=yes") "build_kill=no"))
-                  #t))))
+                    (("build_kill=yes") "build_kill=no"))))))
     (build-system gnu-build-system)
     (outputs '("out"            ;6.4 MiB executables and documentation
                "lib"            ;8.8 MiB shared libraries, headers and locales
@@ -2407,7 +2406,13 @@ (define-public util-linux
                      ;; Change the test to refer to the right file.
                      (substitute* "tests/ts/misc/mcookie"
                        (("/etc/services")
-                        services)))))
+                        services))
+                     (substitute* "tests/helpers/test_mkfds.c"
+                       (("/etc/fstab")
+                        (which "sh")))
+                     (substitute* "tests/helpers/test_enosys.c"
+                       (("/bin/false")
+                        (which "false"))))))
                (add-before 'check 'disable-setarch-test
                  (lambda _
                    ;; The setarch tests are unreliable in QEMU's user-mode
@@ -2457,10 +2462,12 @@ (define-public util-linux
     (inputs
      (list file                         ;for libmagic
            ncurses
+           sqlite
            zlib))
     (native-inputs
      (list net-base                     ;for tests
-           perl))
+           perl
+           pkg-config))
     (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
     (synopsis "Collection of utilities for the Linux kernel")
     (description "Util-linux is a diverse collection of Linux kernel
diff --git a/gnu/packages/patches/util-linux-tests.patch b/gnu/packages/patches/util-linux-tests.patch
index ec1671f2244..496167dbbc9 100644
--- a/gnu/packages/patches/util-linux-tests.patch
+++ b/gnu/packages/patches/util-linux-tests.patch
@@ -1,23 +1,6 @@
-This test checks whether 'root' is successfully translated to UID/GID 0,
-using 'getpwnam' in libmount.  This doesn't work in the chroot because
-/etc/passwd doesn't contain an entry for 'root' so skip it.
-
-The second test requires that '/sys/dev/block' is present, which is not
+This test requires that '/sys/dev/block' is present, which is not
 the case inside the build container.
 
---- util-linux-2.25.2/tests/ts/libmount/optstr	2015-01-23 13:58:41.181151194 +0100
-+++ util-linux-2.25.2/tests/ts/libmount/optstr	2015-01-23 13:58:42.829161716 +0100
-@@ -108,10 +108,6 @@
- ts_run $TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
- ts_finalize_subtest
- 
--ts_init_subtest "fix"
--ts_run $TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
--ts_finalize_subtest
--
- ts_init_subtest "deduplicate"
- ts_run $TESTPROG --dedup bbb,ccc,AAA,xxx,AAA=a,AAA=bbb,ddd,AAA=ccc,fff=eee AAA &> $TS_OUTPUT
- ts_finalize_subtest
 --- a/tests/ts/lsblk/lsblk	2019-03-11 21:08:23.734387391 +0100
 +++ b/tests/ts/lsblk/lsblk	2019-03-11 21:12:43.635473111 +0100
 @@ -22,6 +22,8 @@

base-commit: 3d37134ad6e6edac0a95ee1761ce0cfcad4bc7c9
-- 
2.47.1