Skip to content

ctr: disable slice flag separator on commands - #14185

Merged
samuelkarp merged 1 commit into
containerd:mainfrom
samuelkarp:fix_cli_flag_separator
Sep 17, 2026
Merged

samuelkarp merged 1 commit into
containerd:mainfrom
samuelkarp:fix_cli_flag_separator

Conversation

@samuelkarp

Copy link
Copy Markdown
Member

In urfave/cli/v3, child commands do not inherit
DisableSliceFlagSeparator from the root command, unlike in urfave/cli/v2. When containerd migrated to v3 in commit f72829f, subcommands inadvertently reverted to splitting slice flags on commas, breaking flags that expect comma-separated values such as --mount type=bind,src=/tmp,dst=/host,options=rbind:ro.

Explicitly set DisableSliceFlagSeparator on all cli.Command structs in cmd/ctr/commands, restoring the behavior where slice flags are not split on commas.

Fixes #14181

Assisted-by: Antigravity

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is mechanically consistent across commands and includes targeted tests demonstrating the restored comma-preserving slice-flag behavior.

Pull request overview

Restores ctr’s pre-urfave/cli/v3 behavior where slice flags are not split on commas by explicitly setting DisableSliceFlagSeparator: true on all cli.Command definitions under cmd/ctr/commands, preventing regressions for flags that legitimately contain commas (e.g., --mount, --env, --label, --annotation).

Changes:

  • Set DisableSliceFlagSeparator: true across ctr subcommands so slice-flag parsing behavior is consistent in urfave/cli/v3.
  • Add focused unit tests to validate comma-containing slice-flag values are preserved for ctr run and ctr containers create.
File summaries
File Description
cmd/ctr/commands/version/version.go Disable comma-splitting for slice flags on version command.
cmd/ctr/commands/tasks/tasks.go Disable comma-splitting for slice flags on tasks root command.
cmd/ctr/commands/tasks/start.go Disable comma-splitting for slice flags on tasks start.
cmd/ctr/commands/tasks/resume.go Disable comma-splitting for slice flags on tasks resume.
cmd/ctr/commands/tasks/ps.go Disable comma-splitting for slice flags on tasks ps.
cmd/ctr/commands/tasks/pause.go Disable comma-splitting for slice flags on tasks pause.
cmd/ctr/commands/tasks/metrics.go Disable comma-splitting for slice flags on tasks metrics.
cmd/ctr/commands/tasks/list.go Disable comma-splitting for slice flags on tasks list.
cmd/ctr/commands/tasks/kill.go Disable comma-splitting for slice flags on tasks kill.
cmd/ctr/commands/tasks/exec.go Disable comma-splitting for slice flags on tasks exec.
cmd/ctr/commands/tasks/delete.go Disable comma-splitting for slice flags on tasks delete.
cmd/ctr/commands/tasks/checkpoint.go Disable comma-splitting for slice flags on tasks checkpoint.
cmd/ctr/commands/tasks/attach.go Disable comma-splitting for slice flags on tasks attach.
cmd/ctr/commands/snapshots/snapshots.go Disable comma-splitting for slice flags across snapshots commands/subcommands.
cmd/ctr/commands/shim/shim.go Disable comma-splitting for slice flags across shim commands/subcommands.
cmd/ctr/commands/shim/pprof.go Disable comma-splitting for slice flags across shim pprof subcommands.
cmd/ctr/commands/sandboxes/sandboxes.go Disable comma-splitting for slice flags across sandboxes commands/subcommands.
cmd/ctr/commands/run/run.go Disable comma-splitting for slice flags on run.
cmd/ctr/commands/run/run_test.go New tests verifying run slice flags preserve comma-containing values.
cmd/ctr/commands/pprof/pprof.go Disable comma-splitting for slice flags across pprof subcommands.
cmd/ctr/commands/plugins/plugins.go Disable comma-splitting for slice flags across plugins commands/subcommands.
cmd/ctr/commands/oci/oci.go Disable comma-splitting for slice flags across oci commands/subcommands.
cmd/ctr/commands/namespaces/namespaces.go Disable comma-splitting for slice flags across namespaces commands/subcommands.
cmd/ctr/commands/leases/leases.go Disable comma-splitting for slice flags across leases commands/subcommands.
cmd/ctr/commands/install/install.go Disable comma-splitting for slice flags on install.
cmd/ctr/commands/info/info.go Disable comma-splitting for slice flags on info.
cmd/ctr/commands/images/usage.go Disable comma-splitting for slice flags on images usage.
cmd/ctr/commands/images/unmount.go Disable comma-splitting for slice flags on images unmount.
cmd/ctr/commands/images/tag.go Disable comma-splitting for slice flags on images tag.
cmd/ctr/commands/images/push.go Disable comma-splitting for slice flags on images push.
cmd/ctr/commands/images/pull.go Disable comma-splitting for slice flags on images pull.
cmd/ctr/commands/images/mount.go Disable comma-splitting for slice flags on images mount.
cmd/ctr/commands/images/inspect.go Disable comma-splitting for slice flags on images inspect.
cmd/ctr/commands/images/import.go Disable comma-splitting for slice flags on images import.
cmd/ctr/commands/images/images.go Disable comma-splitting for slice flags across images commands/subcommands.
cmd/ctr/commands/images/export.go Disable comma-splitting for slice flags on images export.
cmd/ctr/commands/images/convert.go Disable comma-splitting for slice flags on images convert.
cmd/ctr/commands/images/build_erofs_cache.go Disable comma-splitting for slice flags on images build-erofs-cache.
cmd/ctr/commands/events/events.go Disable comma-splitting for slice flags on events.
cmd/ctr/commands/deprecations/deprecations.go Disable comma-splitting for slice flags across deprecations commands.
cmd/ctr/commands/content/prune.go Disable comma-splitting for slice flags across content prune commands.
cmd/ctr/commands/content/fetch.go Disable comma-splitting for slice flags on content fetch.
cmd/ctr/commands/content/content.go Disable comma-splitting for slice flags across content commands/subcommands.
cmd/ctr/commands/containers/restore.go Disable comma-splitting for slice flags on containers restore.
cmd/ctr/commands/containers/containers.go Disable comma-splitting for slice flags across containers commands/subcommands.
cmd/ctr/commands/containers/containers_test.go New tests verifying containers create slice flags preserve comma-containing values.
cmd/ctr/commands/containers/checkpoint.go Disable comma-splitting for slice flags on containers checkpoint.
Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@thaJeztah thaJeztah added the cherry-pick/2.4.x Change to be cherry picked to release/2.4 label Sep 17, 2026
In urfave/cli/v3, child commands do not inherit
DisableSliceFlagSeparator from the root command, unlike in
urfave/cli/v2. When containerd migrated to v3 in commit f72829f,
subcommands inadvertently reverted to splitting slice flags on commas,
breaking flags that expect comma-separated values such as
--mount type=bind,src=/tmp,dst=/host,options=rbind:ro.

Explicitly set DisableSliceFlagSeparator on all cli.Command structs in
cmd/ctr/commands, restoring the behavior where slice flags are not
split on commas.

Fixes containerd#14181

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <[email protected]>
Copilot AI review requested due to automatic review settings September 17, 2026 17:20
@samuelkarp
samuelkarp force-pushed the fix_cli_flag_separator branch from 61281e4 to ef85c8f Compare September 17, 2026 17:20
@kubernetes-prow kubernetes-prow Bot added size/L and removed size/XXL labels Sep 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is a straightforward, repo-wide configuration fix aligned with the reported root cause, and it includes targeted regression tests covering the comma-splitting behavior.

Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

@thaJeztah

Copy link
Copy Markdown
Member

/cherry-pick release/2.4

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@thaJeztah: once the present PR merges, I will cherry-pick it on top of release/2.4 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release/2.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Sep 17, 2026
@samuelkarp
samuelkarp added this pull request to the merge queue Sep 17, 2026
Merged via the queue into containerd:main with commit cc0bb26 Sep 17, 2026
96 of 98 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Sep 17, 2026
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@thaJeztah: new pull request created: #14188

Details

In response to this:

/cherry-pick release/2.4

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@samuelkarp samuelkarp added cherry-picked/2.4.x PR commits are cherry picked into release/2.4 branch and removed cherry-pick/2.4.x Change to be cherry picked to release/2.4 labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/2.4.x PR commits are cherry picked into release/2.4 branch size/L

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

ctr: Subcommands split slice flags (e.g. --mount) on commas after migration to urfave/cli/v3

5 participants