Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix regression in handling flag-values starting with hyphen
Fix for a regression between v1.22.1 and v1.22.2, where flag values starting with a hyphen would be parsed as a flag: runc update test_update --memory-swap -1 Incorrect Usage: flag provided but not defined: -1 This problem was caused by `reorderArgs()` not properly checking if the next arg in the list was a value for the flag (and not the next flag); Before this patch: args before reordering: --opt,--opt-value,arg1 args after reordering: --opt,arg1,--opt-value args before reordering: --opt,--opt-value,arg1,arg2 args after reordering: --opt,arg1,--opt-value,arg2 args before reordering: arg1,--opt,--opt-value,arg2 args after reordering: --opt,arg2,arg1,--opt-value After this patch is applied: args before reordering: --opt,--opt-value,arg1 args after reordering: --opt,--opt-value,arg1 args before reordering: --opt,--opt-value,arg1,arg2 args after reordering: --opt,--opt-value,arg1,arg2 args before reordering: arg1,--opt,--opt-value,arg2 args after reordering: --opt,--opt-value,arg1,arg2 Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information