Repository navigation
Description
Background:
Description
In containerd 2.4.0, cmd/ctr was migrated to urfave/cli/v3. While DisableSliceFlagSeparator: true is set on the root ctr command (cmd/ctr/app/main.go), child subcommands (containers create, run, etc.) do not inherit this flag in urfave/cli/v3.
As a result, slice flags containing commas (such as --mount type=bind,src=/path,dst=/path,options=rbind:ro) are erroneously split on commas into separate slice elements with empty destinations, causing container task initialization to fail during runc mount setup:
ctr: failed to create shim task: OCI runtime create failed: runc create failed:
unable to start container process: error during container init:
error mounting "" to rootfs at "": create mountpoint for mount:
mountpoint "/run/containerd/io.containerd.runtime.v2.task/default/test/rootfs" is on the top of rootfs "/run/containerd/io.containerd.runtime.v2.task/default/test/rootfs"
This regression impacts node workflows, diagnostics, autotests, and GKE Installables.
Steps to Reproduce
Run any ctr command passing a --mount flag with comma-separated options:
ctr containers create \
--mount type=bind,src=/var/lib/containerd/binary,dst=/binary,options=bind \
<image> test
ctr task start -d testInspecting the container spec (ctr containers info test) shows the single --mount flag was split into 4 separate mounts:
"mounts": [
{"destination": "", "type": "bind"},
{"destination": "", "source": "/var/lib/containerd/binary"},
{"destination": "/binary"},
{"destination": "", "options": ["bind"]}
]Root Cause
In urfave/cli/v3 (flag_slice_base.go and command.go):
- Multi-value slice flags split on commas by default unless
cmd.DisableSliceFlagSeparator == true. - When subcommands execute,
setMultiValueParsingConfigcheckscmd.DisableSliceFlagSeparatoron the active subcommandcmd. - Unlike
useShortOptionHandling(),urfave/cli/v3does not traversecmd.Lineage()forDisableSliceFlagSeparator(see also urfave/cli#1856). - Because
ctronly setsDisableSliceFlagSeparator: trueon the root command, all subcommands execute withDisableSliceFlagSeparator: false.
Proposed Fix
Explicitly set DisableSliceFlagSeparator: true on all subcommands where slice flags are accepted, or traverse command definitions when constructing ctr commands.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
ctr: disable slice flag separator on commands
ctr: disable slice flag separator on commands