Unrecognized argument when multiple different actions have the same flag value #881
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#881
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I'm trying to run a borgmatic action that receives a command-line flag (as part of testing an unrelated ticket's implementation), but I'm receiving an error:
Unrecognized argument: 1
where1
is the flag's value.Steps to reproduce
Actual behavior
Expected behavior
The arguments parse and the borgmatic
check
action proceeds.Other notes / implementation ideas
This only happens when a flag's value is present for multiple actions in the command-line. For instance, here
-v 1
is a flag and value for the global action and--match-archives 1
is a flag and (the same) value for thecheck
action. But if the--match-archives
value is changed to anything else, there is no error.This occurs because of an unfortunate bug in
get_unparsable_arguments()
; it's blindly looking for any argument strings that show up across actions, treating them as "unparsable" arguments that no actions have consumed. And those get reported as unrecognized arguments to the user.borgmatic version
1.8.11 or main
borgmatic installation method
pipx install --editable
Borg version
1.2.8
Python version
3.12.3
Database version (if applicable)
No response
Operating system and version
Manjaro stable
Fixed in main. Will be part of the next release.
Released in borgmatic 1.8.12!