Skip to content

Commit 79aa28e

Browse files
authored
{k3s,nixos/kubernetes}: use util-linux.withPatches (#409332)
2 parents 1ccd526 + e14de85 commit 79aa28e

File tree

4 files changed

+61
-13
lines changed

4 files changed

+61
-13
lines changed

nixos/modules/services/cluster/kubernetes/kubelet.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ in
336336
[
337337
gitMinimal
338338
openssh
339-
util-linux
339+
# TODO (#409339): remove this patch. We had to add it to avoid a mass rebuild
340+
# for the 25.05 release. Once the staging cycle referenced in the above PR completes,
341+
# switch back to plain util-linux.
342+
util-linux.withPatches
340343
iproute2
341344
ethtool
342345
thin-provisioning-tools

pkgs/applications/networking/cluster/k3s/builder.nix

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,10 @@ let
333333
}).overrideAttrs
334334
overrideContainerdAttrs;
335335

336-
# TODO (#405952): remove this patch. We had to add it to avoid a mass rebuild
337-
# for the 25.05 release. Once the above PR is merged, switch back to plain util-linuxMinimal.
338-
k3sUtilLinux = util-linuxMinimal.overrideAttrs (prev: {
339-
patches =
340-
prev.patches or [ ]
341-
++ lib.singleton (fetchpatch {
342-
url = "https://github.com/util-linux/util-linux/commit/7dbfe31a83f45d5aef2b508697e9511c569ffbc8.patch";
343-
hash = "sha256-bJqpZiPli5Pm/XpDA445Ab5jesXrlcnaO6e4V0B3rSw=";
344-
});
345-
});
336+
# TODO (#409339): remove this patch. We had to add it to avoid a mass rebuild
337+
# for the 25.05 release. Once the staging cycle referenced in the above PR completes,
338+
# switch back to plain util-linuxMinimal.
339+
k3sUtilLinux = util-linuxMinimal.withPatches;
346340
in
347341
buildGoModule rec {
348342
pname = "k3s";
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 7dbfe31a83f45d5aef2b508697e9511c569ffbc8 Mon Sep 17 00:00:00 2001
2+
From: Karel Zak <[email protected]>
3+
Date: Mon, 24 Mar 2025 14:31:05 +0100
4+
Subject: [PATCH] libmount: fix --no-canonicalize regression
5+
6+
Fixes: https://github.com/util-linux/util-linux/issues/3474
7+
Signed-off-by: Karel Zak <[email protected]>
8+
---
9+
libmount/src/context.c | 3 ---
10+
sys-utils/mount.8.adoc | 2 +-
11+
2 files changed, 1 insertion(+), 4 deletions(-)
12+
13+
diff --git a/libmount/src/context.c b/libmount/src/context.c
14+
index 0323cb23d34..15a8ad3bbd0 100644
15+
--- a/libmount/src/context.c
16+
+++ b/libmount/src/context.c
17+
@@ -530,9 +530,6 @@ int mnt_context_is_xnocanonicalize(
18+
assert(cxt);
19+
assert(type);
20+
21+
- if (mnt_context_is_nocanonicalize(cxt))
22+
- return 1;
23+
-
24+
ol = mnt_context_get_optlist(cxt);
25+
if (!ol)
26+
return 0;
27+
diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc
28+
index 4f23f8d1f0e..5103b91c578 100644
29+
--- a/sys-utils/mount.8.adoc
30+
+++ b/sys-utils/mount.8.adoc
31+
@@ -756,7 +756,7 @@ Allow to make a target directory (mountpoint) if it does not exist yet. The opti
32+
*X-mount.nocanonicalize*[**=**_type_]::
33+
Allows disabling of canonicalization for mount source and target paths. By default, the `mount` command resolves all paths to their absolute paths without symlinks. However, this behavior may not be desired in certain situations, such as when binding a mount over a symlink, or a symlink over a directory or another symlink. The optional argument _type_ can be either "source" or "target" (mountpoint). If no _type_ is specified, then canonicalization is disabled for both types. This mount option does not affect the conversion of source tags (e.g. LABEL= or UUID=) and fstab processing.
34+
+
35+
-The command line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but it does not modify flags for open_tree syscalls.
36+
+The command-line option *--no-canonicalize* overrides this mount option and affects all path and tag conversions in all situations, but for backward compatibility, it does not modify open_tree syscall flags and does not allow the bind-mount over a symlink use case.
37+
+
38+
Note that *mount*(8) still sanitizes and canonicalizes the source and target paths specified on the command line by non-root users, regardless of the X-mount.nocanonicalize setting.
39+

pkgs/by-name/ut/util-linux/package.nix

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
let
3535
isMinimal = cryptsetupSupport == false && !nlsSupport && !ncursesSupport && !systemdSupport;
3636
in
37-
stdenv.mkDerivation rec {
37+
stdenv.mkDerivation (finalPackage: rec {
3838
pname = "util-linux" + lib.optionalString isMinimal "-minimal";
3939
version = "2.41";
4040

@@ -200,6 +200,18 @@ stdenv.mkDerivation rec {
200200
'';
201201

202202
passthru = {
203+
# TODO (#409339): Remove this hack. We had to add it to avoid a mass rebuild
204+
# for the 25.05 release to fix Kubernetes. Once the staging cycle referenced
205+
# in the above PR completes, this passthru and all consumers of it should go away.
206+
withPatches = finalPackage.overrideAttrs (prev: {
207+
patches = lib.unique (
208+
prev.patches or [ ]
209+
++ [
210+
./fix-mount-regression.patch
211+
]
212+
);
213+
});
214+
203215
updateScript = gitUpdater {
204216
# No nicer place to find latest release.
205217
url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git";
@@ -237,4 +249,4 @@ stdenv.mkDerivation rec {
237249
];
238250
priority = 6; # lower priority than coreutils ("kill") and shadow ("login" etc.) packages
239251
};
240-
}
252+
})

0 commit comments

Comments
 (0)