diff --git a/containerd.spec b/containerd.spec index 6924d35f44c812bef97058c491012be9c82cf3be..3f85a13d7fd02470370903cf4f5c54732b9dcb10 100644 --- a/containerd.spec +++ b/containerd.spec @@ -2,7 +2,7 @@ %global debug_package %{nil} Version: 1.2.0 Name: containerd -Release: 220 +Release: 221 Summary: An industry-standard container runtime License: ASL 2.0 URL: https://containerd.io @@ -44,6 +44,12 @@ install -p -m 755 bin/ctr $RPM_BUILD_ROOT/%{_bindir}/ctr %{_bindir}/ctr %changelog +* Fri Aug 29 2025 Yu Peng - 1.2.0-221 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix ctr snapshot mount produce invalid mount command for empty option + * Thu Aug 21 2025 Yu Peng - 1.2.0-220 - Type:bugfix - ID:NA diff --git a/patch/0115-containerd-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch b/patch/0115-containerd-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c6903370532e39fc4f6fae766a5d0f2d872c7b6 --- /dev/null +++ b/patch/0115-containerd-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/series.conf b/series.conf index ad843fefc620defb3d8c05cf7ae86db552d15b28..7764e525c0c55766694d113c5ff0537dff9d3913 100644 --- a/series.conf +++ b/series.conf @@ -116,3 +116,4 @@ patch/0111-containerd-disable-Transparent-HugePage-for-shim-pro.patch patch/0112-containerd-cio-FIFOSet.Close-check-if-FIFOSet-is-nill-to-preven.patch patch/0113-containerd-fix-CVE-2024-40635.patch patch/0114-containerd-remove-limitnofile-from-containerd-service.patch +patch/0115-containerd-Fix-ctr-snapshot-mount-produce-invalid-mount-command.patch