Skip to content

No command besides "init" should create a repository #1167

@mbiebl

Description

@mbiebl

Output of restic version

restic 0.7.1
compiled with go1.8.3 on linux/amd64

Today, restic scared my good.
I ran restic -r /mnt/bacup/restic snaphosts and got

unable to open config file: Stat: stat /mnt/bacup/restic/config: no such file or directory
Is there a repository at the following location?
/mnt/bacup/restic

I quickly checked /mnt/bacup/restic/ and indeed, the config file was missing. I was already worried that my repository was hosed. Then it dawned on me, that I simply had typoed the repository path (which should have been /mnt/backup/restic).
restic unhelpfully had created a /mnt/bacup/restic directory/repository.

Imho, restic should never auto-create a repository. The only time this should happen is on restic init.
It should simply return an error in such a case.
To reproduce the error, run
restic -r /tmp/typo snapshots and see that restic has created something at /tmp/typo which looks like a (incomplete) repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions