Skip to content

data loss: borg prune -P-- affects all archives #4769

@horazont

Description

@horazont

Have you checked borgbackup docs, FAQ, and open Github issues?

Yes

Is this a BUG / ISSUE report or a QUESTION?

BUG

System information. For client/server mode post info for both machines.

Your borg version (borg -V).

borg 1.1.10

Operating system (distribution) and version.

Debian testing, Debian stable (both)

Hardware / network configuration, and filesystems used.

ext4, tmpfs

How much data is handled by borg?

several TB, a few MB

Full borg commandline that lead to the problem (leave away excludes and passwords)

$ borg prune -d7 --stats -P-- io

Describe the problem you're observing.

Can you reproduce the problem? If so, describe how. If not, describe troubleshooting steps you took before opening the issue.

Yes:

$ borg init -e none test
$ borg create "test::test-$(date --iso-8601=seconds)" icons
$ borg create "test::--$(date --iso-8601=seconds)" icons
$ borg create "test::test-$(date --iso-8601=seconds)" icons
$ borg create "test::--$(date --iso-8601=seconds)" icons
$ borg prune -n --list --keep-hourly 1 -Ptest- test
Keeping archive: test-2019-09-29T18:11:06+02:00       Sun, 2019-09-29 18:11:06 [9d1c048374200473d4c2155488e24e8e6ea37c1b257e2bd684dff0c49f1f73cf]
Would prune:     test-2019-09-29T18:10:57+02:00       Sun, 2019-09-29 18:10:57 [f2d53c6752713f68d7e1409784ee22cdb2e8ca7094286e0199bbf919c5548c86]
$ borg prune -n --list --keep-hourly 1 -P-- test
Keeping archive: --2019-09-29T18:11:09+02:00          Sun, 2019-09-29 18:11:09 [6f59a4b2575626a2a8fa748be6e44abd6bb4db17ee1db0dfe67ab10b095ea71e]
Would prune:     test-2019-09-29T18:11:06+02:00       Sun, 2019-09-29 18:11:06 [9d1c048374200473d4c2155488e24e8e6ea37c1b257e2bd684dff0c49f1f73cf]
Would prune:     --2019-09-29T18:11:02+02:00          Sun, 2019-09-29 18:11:03 [795d5c84deb4d646135ae7fcf853a2f7537418b81f91aefba74a8e9bc097e5bb]
Would prune:     test-2019-09-29T18:10:57+02:00       Sun, 2019-09-29 18:10:57 [f2d53c6752713f68d7e1409784ee22cdb2e8ca7094286e0199bbf919c5548c86]

As you can see, borg prune will prune all archives when invoked with -P--. This does not happen with -P- or -P---. It also happens with --prefix=--, but not with '-a--*'.

I would expect borg to either:

  • Complain about a malformed argument if it can’t deal with -- for whatever reason, or
  • Operate correctly only pruning archives starting with --

Instead, it pruned away many my backups because I assumed this would work :/ and did not do another --dry-run.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions