Repository navigation
Description
The documented form of vfox exec is vfox exec <sdk-name>[@<version>]... -- <command> [args...] (docs/usage/core-commands.md). The form without -- is accepted for one SDK, but an argument of the command that starts with a dash does not reach the command: --version prints the vfox version and the command runs without it, and --help is read as a help topic. This is the same parser problem as #808 (search), in the exec command.
Reproduction on a GitHub-hosted runner (Ubuntu 26.04.1, x86_64) with the vfox 1.1.0 release archive (checksum verified) and the zip archive of the vfox-etcd v0.2.3 tag, with etcd 3.5.12 installed by vfox exec [email protected] -- etcd --version. Run: https://github.com/version-fox/vfox-plus/actions/runs/45057624973 (the -- form also works in the earlier run https://github.com/version-fox/vfox-plus/actions/runs/45056971190)
| Command | Result |
|---|---|
vfox exec [email protected] -- etcd --version |
etcd Version: 3.5.12, exit 0 (control) |
vfox exec [email protected] etcd --version |
stderr 1.1.0; etcd starts with no arguments and keeps running; stopped by timeout after 30 seconds (exit 124) |
vfox exec clang --version (clang not installed) |
stderr 1.1.0, then usage: vfox exec <sdk>[@<version>]... -- <command> [args...], exit 1 |
vfox exec [email protected] etcd --help |
stderr No help topic for '[email protected]', exit 1; etcd's help is not reached |
vfox exec [email protected] etcd version |
passes version to etcd |
vfox --version |
vfox version 1.1.0, exit 0 |
Cause: the custom cli.VersionFlag in cmd/cmd.go:49-57 prints the version and returns nil, so the command carries on. vfox still recognises the flag after the SDK name, so --version is removed before cmd/commands/exec.go:51 reads the arguments. parseExecInvocation then sees [email protected] etcd, which it reads as one SDK and the command etcd with no arguments (exec.go:82-90). For clang --version one argument is left, which gives the usage error. The -- branch avoids this, because it reads the raw arguments (exec.go:63-66).
Expected: the arguments after the command name reach the command, as they do after --. Alternatively, the form without -- refuses an argument that starts with a dash, instead of running a different command.
Possible fix: stop flag parsing at the first argument after the SDK specifications, for example with SkipFlagParsing on the exec command, reading the SDK specifications from the raw arguments as the -- branch does.
Activity
fix(exec): narrow PR to version-fox#824 and fix path-like and version…