Init with empty password creates directory structure, but no config file

Hi!

I am testing out restic, and wondered if it would work without giving a password on init. So I just pressed enter twice when asked for password.

$ restic init --repo .
enter password for new repository:
enter password again:
an empty password is not a password
main.ReadPassword
        /restic/cmd/restic/global.go:360
main.ReadPasswordTwice
        /restic/cmd/restic/global.go:374
main.runInit
        /restic/cmd/restic/cmd_init.go:65
main.glob..func12
        /restic/cmd/restic/cmd_init.go:25
github.com/spf13/cobra.(*Command).execute
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826
github.com/spf13/cobra.(*Command).ExecuteC
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /home/build/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main
        /restic/cmd/restic/main.go:98
runtime.main
        /usr/local/go/src/runtime/proc.go:204
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1374

This resulted in a bunch of expected directories being created, but no config file.

I now understand that a password is required, but I think that creating a partially incomplete repository even though no password was given is a (minor) bug. Thoughts?

Best Regards,
/Martin

I agree, you shouldn’t get a stack trace :slight_smile: Can you open an issue over at GitHub?

Sure, I will.
Thank you!

EDIT: OK, a stacktrace was unexpected. But what about the incomplete repo?

Ping @rawtaz . I suspect you were not notified about my edit above…

Although I’m not familiar with the code at all, I would suspect the two to be related.

If the situation is handled properly the repo will only be created (and then completely) when a proper password is provided. Please mention in the symptoms you listed in your first post in this thread, and it will be good.

Created issue Init with empty password causes 1) directory structure without config file and 2) strack trace · Issue #3214 · restic/restic · GitHub .