From d6c1f136e4185ea82e1b53b2d603868a6ab50e65 Mon Sep 17 00:00:00 2001 From: "eyjhbb@gmail.com" Date: Sat, 22 Sep 2018 12:43:08 +0200 Subject: [PATCH 1/2] 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 } From 9c18f033f796e6a410b90dc5b5498836b2a42338 Mon Sep 17 00:00:00 2001 From: "eyjhbb@gmail.com" Date: Mon, 24 Sep 2018 15:15:24 +0200 Subject: [PATCH 2/2] pass: changed error message returned, if password-store is not initialized Signed-off-by: eyjhbb@gmail.com --- pass/pass_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pass/pass_linux.go b/pass/pass_linux.go index 0e5a09a..342e538 100644 --- a/pass/pass_linux.go +++ b/pass/pass_linux.go @@ -49,7 +49,7 @@ func (p Pass) checkInitialized() error { // 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) + return fmt.Errorf("pass not initialized: %v", err) } passInitialized = true return nil