Restic forget has undefined sort order for output

restic 0.12.1 - the command line is

restic forget --no-cache --password-file=/etc/restaround/windows/password-file --repo=/backup/restic/windows --keep-hourly=96 --keep-daily=30 --keep-monthly=14 --keep-yearly=20

The sort order of the different sections starting with “keep xxx snapshots” is random. Could you please set a fixed order so the output is always identical?

Also, it might make the output easier to read for beginners if the section start would show its selection criteria, so instead of

keep 48 snapshots:

say e.g. (only show attributes defined by --group-by, the display order should match here too)

keep 48 snapshots for host sysname, paths /home/whatever and /home/somethingelse:

What actual practical problem are you suggesting to solve by this?

If you need structured output for parsing, which would make sense from a keep it consistent point of view, you should instead use the --json flag, which enables you to easily process the structured information using e.g. jq (try adding | jq to the end of your command).

The actual problem is the time it takes users to wonder if this behaviour is correct. When it is about backups, I want to be on the safe side.

I do not like irritations like undefined behaviour. If the output is not identical for identical input I need to check everything for finding the reason for differences.

1 Like