Repository navigation
ctr: preserve args after "-" in images export - #14217
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The argument reconstruction must preserve preceding flags and -- separator semantics.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds a workaround for preserving arguments after - in ctr images export, with regression tests.
Changes:
- Reconstructs and reparses arguments for stdout exports.
- Adds tests for trailing images and flags.
| File | Summary |
|---|---|
cmd/ctr/commands/images/export.go |
Implements argument recovery; reparsing currently drops preceding flags and mishandles -- before the output dash. |
cmd/ctr/commands/images/export_test.go |
Adds regression coverage for dash-output argument handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
urfave/cli/v3 breaks out of its flag parsing loop when it encounters a "-" positional argument without appending the remaining arguments, causing "ctr images export - <image>" to drop all image references and flags following "-". When <out> is "-", recover the un-truncated arguments from the parent "images" command lineage and re-parse the tail starting at "-" with a sentinel placeholder so trailing image references and flags are preserved. This workaround can be removed after the bug is fixed upstream: * urfave/cli#2418 * urfave/cli#2419 Assisted-by: Antigravity Signed-off-by: Samuel Karp <[email protected]>
c851c44 to
72c741e
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
Sorry for causing these with my v3 bump! (I guess the positive side is that we found missing coverage)
|
/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: #14219 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. |

urfave/cli/v3 breaks out of its flag parsing loop when it encounters a "-" positional argument without appending the remaining arguments, causing "ctr images export -
" to drop all image references and flags following "-".
When is "-", recover the un-truncated arguments from the parent "images" command lineage and re-parse the tail starting at "-" with a sentinel placeholder so trailing image references and flags are preserved.
This workaround can be removed after the bug is fixed upstream:
Assisted-by: Antigravity