Forget --prune appears not to actually delete anything (?)

I’m new, so it’s entirely possible that I’m misunderstanding the semantics of forgetting/pruning, but my impression is:

  • forgetwithout--prune” will remove the references to data in the repo, but leave the actual data there.
  • forgetwith--prune” will remove the references to data, and then prune (delete) the files from the repo.

I think, but this is where I might be wrong, that a sequence of “forget a snapshot” followed by “prune with no other arguments” should be the same end result as running forget --prune <snapshot>. And just to be extra certain, I ran both forget <snap> --prune and forget --prune <snap> in case the argument ordering mattered for some reason.

I can reproduce this on 0.8.1/linux reliably: I think I already have the fix for #1317, but I didn’t see anything else that looked relevant.

Am I misunderstanding how prune/forget are supposed to interact, or a bug, or something else?

Reproduction steps are :

  1. init repo
  2. run a backup
  3. forget --prune this snapshot
    3a: snapshot disappears, but the files are still there.
  4. if you explicitly call prune by itself, all corresponding files in the repo are actually deleted.

Log file attached with an example… let me know if other info might help?

lwobker@lwobker-vms:~/.restic$ restic version
restic 0.8.1
compiled with go1.9 on linux/amd64

lwobker@lwobker-vms:~/.restic$ restic init
created restic backend 84f1255c01 at b2:vms-restic


lwobker@lwobker-vms:~/.restic$ restic backup /storage/slashetc
password is correct
scan [/storage/slashetc]
[0:11] 82.73%  536.443 KiB/s  5.763 MiB / 6.966 MiB  3486 / 3541 items  55 errors  ETA 0:02 
duration: 0:11, 0.58MiB/s
snapshot 55c23f25 saved


lwobker@lwobker-vms:~/.restic$ restic forget --prune 55c23f25
password is correct
removed snapshot 55c23f25

NOTE : files were NOT removed from repo at this point…

lwobker@lwobker-vms:~/.restic$ restic prune
password is correct
counting files in repo
building new index for repo
[0:01] 100.00%  6 / 6 packs
repository contains 6 packs (2188 blobs) with 7.033 MiB
processed 2188 blobs: 0 duplicate blobs, 0B duplicate
load all snapshots
find data that is still in use for 0 snapshots
[0:00]   0 / 0 snapshots
found 0 of 2188 data blobs still in use, removing 2188 blobs
will remove 0 invalid files
will delete 6 packs and rewrite 0 packs, this frees 6.956 MiB
counting files in repo
[0:00]   0 / 0 packs
finding old index files
saved new index as b341772a
remove 1 old index files
[0:01] 100.00%  6 / 6 packs deleted
done

Congratulations, you’ve found a bug. Thanks for reporting it!

I though I had resolved #1317, but it seems I haven’t. I can reproduce the issue.

The GitHub issue tracker would be more appropriate for reporting the bug, but we can leave it here for now.

Addressed in https://github.com/restic/restic/pull/1518

Cool deal - I couldn’t convince myself it was actually a bug otherwise I would have gone straight to the issue tracker :wink: