Skip to content

restic exit code incoherency on forget operation #5254

@deajan

Description

@deajan

Output of restic version

restic 0.17.3 compiled with go1.23.3 on linux/amd64

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

S3 Minio server

Problem description / Steps to reproduce

When using forget command on a S3 repository, failures (because of S3 policies that don't allow deletions) will still make restic exit with exit code 0, rendering scripting difficult.

Example:

# /usr/local/bin/restic forget 09866f87
repository abcdedf opened (version 2, compression level auto)
found 3 old cache directories in /root/.cache/restic, run `restic cache --cleanup` to remove them
Remove(<snapshot/09866f8748>) failed: client.RemoveObject: Access Denied.
unable to remove snapshot/09866f8748d3c5fd70bc7bfa2c846253c6b0c76acddfab4559e27820be71b693 from the repository
[0:00] 100.00%  1 / 1 files deleted
# echo $?
0

Expected behavior

Guess the exit code should not be 0.

Actual behavior

Looks like restic still thinks that the transaction with the S3 server succeed, even if said otherwise.

Did restic help you today? Did it make you happy in any way?

Still using restic alot with about 20TB of data and hundreds / thousands of snapshots. Best decision I took to give restic a test drive ^^

Btw, I do have a file where I record restic CLI inconsistencies I encounter while developping around restic. Perhaps you could have a look at https://github.com/netinvent/npbackup/blob/main/RESTIC_CMDLINE_CONSISTENCY.md

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions