From f6e3efa545525def2ca409533ee78e35241568bc Mon Sep 17 00:00:00 2001 From: weiyucheng123 Date: Thu, 11 Dec 2025 17:29:43 +0800 Subject: [PATCH] Fix ctr snapshot mount produce invalid mount command for empty option --- ...-mount-produce-invalid-mount-command.patch | 43 +++++++++++++++++++ k3s-containerd.spec | 9 +++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0012-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch diff --git a/0012-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch b/0012-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch new file mode 100644 index 0000000..4c69033 --- /dev/null +++ b/0012-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch @@ -0,0 +1,43 @@ +From bd9e577c267b8bad4537203c85a7d24c3a3d4555 Mon Sep 17 00:00:00 2001 +From: Chenyang Yan +Date: Sat, 9 Aug 2025 14:57:40 +0800 +Subject: [PATCH] Fix ctr snapshot mount produce invalid mount command for + empty option + +snapshotter.Mounts() maybe get empty Options for different snapshot service. + +Empty Options will produce invalid mount command from printMounts: + +Origin: https://github.com/containerd/containerd/commit/bd9e577c267b8bad4537203c85a7d24c3a3d4555 +``` +$ ctr -n flintlock snapshot --snapshotter devmapper mount /mnt flintlock/flintlock/demo-2/01K24ZRN9EFAVQVNGXQS26BYVG/root +mount -t ext4 /dev/mapper/fc-dev-thinpool-snap-19 /mnt -o +$ cmd=$(ctr -n flintlock snapshot --snapshotter devmapper mount /mnt flintlock/flintlock/demo-2/01K24ZRN9EFAVQVNGXQS26BYVG/root) +$ $cmd +mount: option requires an argument -- 'o' +Try 'mount --help' for more information. +``` + +Signed-off-by: Chenyang Yan +--- + cmd/ctr/commands/snapshots/snapshots.go | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/cmd/ctr/commands/snapshots/snapshots.go b/cmd/ctr/commands/snapshots/snapshots.go +index 3ae1491cd..623e700a4 100644 +--- a/cmd/ctr/commands/snapshots/snapshots.go ++++ b/cmd/ctr/commands/snapshots/snapshots.go +@@ -639,6 +640,10 @@ + func printMounts(target string, mounts []mount.Mount) { + // FIXME: This is specific to Unix + for _, m := range mounts { +- fmt.Printf("mount -t %s %s %s -o %s\n", m.Type, m.Source, target, strings.Join(m.Options, ",")) ++ var opt string ++ if len(m.Options) > 0 { ++ opt = fmt.Sprintf(" -o %s", strings.Join(m.Options, ",")) ++ } ++ fmt.Printf("mount -t %s %s %s%s\n", m.Type, m.Source, target, opt) + } + } + + diff --git a/k3s-containerd.spec b/k3s-containerd.spec index b458c9c..4b7af3d 100644 --- a/k3s-containerd.spec +++ b/k3s-containerd.spec @@ -3,7 +3,7 @@ %global version_suffix k3s1 Version: 1.6.6 Name: k3s-containerd -Release: 17 +Release: 18 Summary: An industry-standard container runtime License: Apache-2.0 URL: https://github.com/k3s-io/containerd @@ -23,6 +23,7 @@ Patch0008: 0008-fix-CVE-2024-40635.patch Patch0009: 0009-fix-CVE-2024-25621.patch Patch0010: 0010-fix-CVE-2025-64329.patch Patch0011: 0011-client-fix-returned-error-in-the-defer-function.patch +Patch0012: 0012-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch BuildRequires: golang glibc-static make btrfs-progs-devel @@ -87,6 +88,12 @@ cp -rf %{_builddir}/containerd-%{version}-%{version_suffix}/. %{buildroot}%{_lib %changelog +* Thu Dec 11 2025 weiyucheng - 1.6.6-18 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC: Fix ctr snapshot mount produce invalid mount command for empty option + * Thu Dec 11 2025 weiyucheng - 1.6.6-17 - Type:bugfix - CVE:NA -- Gitee