Repository navigation
ctr: disable slice flag separator on commands - #14185
Conversation
There was a problem hiding this comment.
🟢 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: trueacrossctrsubcommands so slice-flag parsing behavior is consistent inurfave/cli/v3. - Add focused unit tests to validate comma-containing slice-flag values are preserved for
ctr runandctr 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.
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]>
61281e4 to
ef85c8f
Compare
There was a problem hiding this comment.
🟢 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
|
/cherry-pick release/2.4 |
|
@thaJeztah: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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. |
|
@thaJeztah: new pull request created: #14188 DetailsIn response to this:
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. |
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