From d6c1f136e4185ea82e1b53b2d603868a6ab50e65 Mon Sep 17 00:00:00 2001 From: "eyjhbb@gmail.com" Date: Sat, 22 Sep 2018 12:43:08 +0200 Subject: [PATCH] pass: changed the way for checking if password-store is initalized Signed-off-by: eyjhbb@gmail.com --- pass/pass_linux.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pass/pass_linux.go b/pass/pass_linux.go index 66f372b..0e5a09a 100644 --- a/pass/pass_linux.go +++ b/pass/pass_linux.go @@ -46,26 +46,11 @@ func (p Pass) checkInitialized() error { if passInitialized { return nil } - // In principle, we could just run `pass init`. However, pass has a bug - // where if gpg fails, it doesn't always exit 1. Additionally, pass - // uses gpg2, but gpg is the default, which may be confusing. So let's - // just explictily check that pass actually can store and retreive a - // password. - password := "pass is initialized" - name := path.Join(getPassDir(), "docker-pass-initialized-check") - - _, err := p.runPassHelper(password, "insert", "-f", "-m", name) + // We just run a `pass ls`, if it fails then pass is not initialized. + _, err := p.runPassHelper("", "ls") if err != nil { return fmt.Errorf("error initializing pass: %v", err) } - - stored, err := p.runPassHelper("", "show", name) - if err != nil { - return fmt.Errorf("error fetching password during initialization: %v", err) - } - if stored != password { - return fmt.Errorf("error round-tripping password during initialization: %q != %q", password, stored) - } passInitialized = true return nil }