kpitt / gopass

An experimental fork of gopass, the "slightly more awesome standard unix password manager for teams"

Home Page:https://www.gopass.pw/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The `init` command doesn't fail immediately if store is already initialized

kpitt opened this issue · comments

Summary

When running init on an already-initialized store, it immediately reports that the store is already initialized, but the command doesn't fail until after the user selects the GPG key to use.

Steps To Reproduce

  1. Initialize the root password store with gopass init
  2. Run gopass init a second time

Expected behavior

The command should detect an already-initialized store and fail immediately. It should not prompt the user for additional information that will never be used.

Additional context

The second gopass init command produces the following output:

Initializing a new password store:

✗ Store is already initialized!
- Searching for usable private keys...
! Hint: Use 'gopass init <subkey> to use subkeys!'
? Please select a private key for encrypting secrets:
[...]
Please enter the number of a key (0-2, [q]uit) (q to abort) [0]: 2

Error: Failed to initialize store: failed to init store "" at "~/.local/share/gopass/stores/root": failed to initialize new sub store: found already initialized store at "~/.local/share/gopass/stores/root".
You can add secondary stores with 'gopass init --path <path to secondary store> --store <mount name>'
`