borgmatic borg with --dry-run passed to borgmatic does not actually perform a dry run #774

Closed
opened 2023-10-21 04:13:18 +00:00 by SimonPilkington · 3 comments

What I'm trying to do and why

If borgmatic borg is run with the --dry-run flag passed to borgmatic the arbitrary borg command will be run without a corresponding --dry-run flag. This seems like a good way for a naive user to shoot themselves in the foot.

Steps to reproduce

e.g. borgmatic --dry-run -v 2 borg recreate

Actual behavior

borg --version --debug --show-rc
local: Running actions for repository
/etc/borgmatic/config.yaml: No commands to run for pre-actions hook
local: Running arbitrary Borg command
borg recreate --debug --show-rc --remote-path borg1 > 

Notice no --dry-run in the borg cmdline.

Expected behavior

Nothing potentially destructive happens.

Other notes / implementation ideas

I see two solutions to this.

  1. Make sure to pass on --dry-run to borg.
  2. Yell at the user that passing --dry-run to borgmatic when running borgmatic borg is not supported and to use --dry-run in the borg cmdline instead. Don't actually do anything.

I prefer 2.

borgmatic version

1.8.3

borgmatic installation method

n/a

Borg version

n/a

Python version

n/a

Database version (if applicable)

n/a

Operating system and version

n/a

### What I'm trying to do and why If `borgmatic borg` is run with the `--dry-run` flag passed to borgmatic the arbitrary borg command will be run without a corresponding `--dry-run` flag. This seems like a good way for a naive user to shoot themselves in the foot. ### Steps to reproduce e.g. `borgmatic --dry-run -v 2 borg recreate` ### Actual behavior ``` borg --version --debug --show-rc local: Running actions for repository /etc/borgmatic/config.yaml: No commands to run for pre-actions hook local: Running arbitrary Borg command borg recreate --debug --show-rc --remote-path borg1 > ``` Notice no `--dry-run` in the borg cmdline. ### Expected behavior Nothing potentially destructive happens. ### Other notes / implementation ideas I see two solutions to this. 1. Make sure to pass on `--dry-run` to borg. 2. Yell at the user that passing `--dry-run` to borgmatic when running `borgmatic borg` is not supported and to use `--dry-run` in the borg cmdline instead. Don't actually do anything. I prefer 2. ### borgmatic version 1.8.3 ### borgmatic installation method n/a ### Borg version n/a ### Python version n/a ### Database version (if applicable) n/a ### Operating system and version n/a
Owner

Thanks for filing this! Of the two options you presented, I agree that number 2 probably makes the most sense given the nature of the borgmatic borg action.

Thanks for filing this! Of the two options you presented, I agree that number 2 probably makes the most sense given the nature of the `borgmatic borg` action.
witten added the
good first issue
label 2023-10-21 06:10:10 +00:00
Owner

This is done in main and will be part of the next release. Thanks again for the suggestion!

This is done in main and will be part of the next release. Thanks again for the suggestion!
Owner

Released in borgmatic 1.8.4!

Released in borgmatic 1.8.4!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#774
No description provided.