Skip to content

restic forget doesn't respect $RESTIC_HOST #5325

@seanh

Description

@seanh

Output of restic version

restic 0.18.0 compiled with go1.24.1 on darwin/arm64

What backend/service did you use to store the repository?

Backblaze B2.

Problem description / Steps to reproduce

The manual for restic forget says:

--host=[]      only consider snapshots for this host (can be specified multiple times) (default: **$RESTIC_HOST)**

Expected behavior

If I set the environment variable $RESTIC_HOST then restic forget should only forget snapshots with that host.

Actual behavior:

restic forget forgets snapshots with other hosts:

$ echo $RESTIC_HOST
Four Sunstone
$ restic forget --dry-run --keep-last 1
repository *** opened (version 2, compression level auto)
Applying Policy: keep 1 latest snapshots
keep 1 snapshots:
...
remove 19 snapshots:
...
$ 

(The 19 snapshots that it removes are a bunch of snapshots with hosts other than Four Sunstone.)

If I add the command line argument --host "$RESTIC_HOST" then I do get the behaviour I expect:

$ restic forget --dry-run --keep-last 1 --host "$RESTIC_HOST"
repository *** opened (version 2, compression level auto)
Applying Policy: keep 1 latest snapshots
keep 1 snapshots:
...
$ 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions