Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mbiebl opened this issue Aug 18, 2017 · 4 comments
Closed

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

mbiebl opened this issue Aug 18, 2017 · 4 comments

Comments

@mbiebl
Copy link

mbiebl commented Aug 18, 2017

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.

@fd0
Copy link
Member

fd0 commented Aug 18, 2017

Oh, interesting! That's indeed a bug and I agree with you that only restic init should create a repo. Thanks for the report!

@fd0 fd0 added the type: bug label Aug 18, 2017
@mbiebl
Copy link
Author

mbiebl commented Aug 18, 2017

Thanks for the super fast response!
Fwiw, snapshots is not the only command which currently triggers this behaviour, others like backup or check do so as well.

@fd0
Copy link
Member

fd0 commented Aug 18, 2017

Yeah, I've already triaged the problem ;)

@mbiebl
Copy link
Author

mbiebl commented Aug 18, 2017

Yeah, I've already triaged the problem ;)

You're awesome :-)

fd0 added a commit that referenced this issue Aug 27, 2017
It was discovered that restic creates directories when a non-existing
directory is specified as a local repository.
@fd0 fd0 closed this as completed in #1182 Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants