Package: pass
Version: 1.6.3-1
Severity: wishlist
Tags: patch

I fear that pass still doesn't suite all my use cases and therefore ask
you to take another (small) patch. When gpg2 is installed and no
gpg-agent is running pass fails:

$ pass show foo
gpg: gpg-agent is not available in this session
gpg: can't query passphrase in batch mode
gpg: Invalid passphrase; please try again ...
gpg: can't query passphrase in batch mode
gpg: Invalid passphrase; please try again ...
gpg: can't query passphrase in batch mode
gpg: decryption failed: secret key not available
$ echo $?
2
$

Rather than failing, I'd like it to fall back to reading the passphrase
from the terminal. 

Thanks in advance

Helmut
diff -Nru password-store-1.6.3/debian/changelog 
password-store-1.6.3/debian/changelog
--- password-store-1.6.3/debian/changelog       2014-07-03 12:28:05.000000000 
+0200
+++ password-store-1.6.3/debian/changelog       2014-07-08 18:47:30.000000000 
+0200
@@ -1,3 +1,10 @@
+password-store (1.6.3-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Support working with gpg2 but without gpg-agent. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 08 Jul 2014 18:47:13 +0200
+
 password-store (1.6.3-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru password-store-1.6.3/debian/patches/gpg2-no-agent.patch 
password-store-1.6.3/debian/patches/gpg2-no-agent.patch
--- password-store-1.6.3/debian/patches/gpg2-no-agent.patch     1970-01-01 
01:00:00.000000000 +0100
+++ password-store-1.6.3/debian/patches/gpg2-no-agent.patch     2014-07-08 
18:54:31.000000000 +0200
@@ -0,0 +1,36 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: Support working with gpg2 but without gpg-agent
+Last-Update: 2014-07-08
+
+If gpg2 happens to be installed and no gpg-agent is running, pass fails rather
+badly:
+
+$ pass show foo
+gpg: gpg-agent is not available in this session
+gpg: can't query passphrase in batch mode
+gpg: Invalid passphrase; please try again ...
+gpg: can't query passphrase in batch mode
+gpg: Invalid passphrase; please try again ...
+gpg: can't query passphrase in batch mode
+gpg: decryption failed: secret key not available
+$ echo $?
+2
+$
+
+This is due to explicitly adding --use-agent even though no agent is available.
+This mode of operation can be handled much better by only setting --use-agent
+when an agent is actually available.
+
+Index: password-store-1.6.3/src/password-store.sh
+===================================================================
+--- password-store-1.6.3.orig/src/password-store.sh    2014-07-08 
18:47:06.000000000 +0200
++++ password-store-1.6.3/src/password-store.sh 2014-07-08 18:48:13.000000000 
+0200
+@@ -9,7 +9,7 @@
+ GPG_OPTS=( "--quiet" "--yes" "--compress-algo=none" )
+ GPG="gpg"
+ which gpg2 &>/dev/null && GPG="gpg2"
+-[[ -n $GPG_AGENT_INFO || $GPG == "gpg2" ]] && GPG_OPTS+=( "--batch" 
"--use-agent" )
++[[ -n $GPG_AGENT_INFO ]] && GPG_OPTS+=( "--batch" "--use-agent" )
+ 
+ PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ X_SELECTION="${PASSWORD_STORE_X_SELECTION:-clipboard}"
diff -Nru password-store-1.6.3/debian/patches/series 
password-store-1.6.3/debian/patches/series
--- password-store-1.6.3/debian/patches/series  2014-07-03 12:18:46.000000000 
+0200
+++ password-store-1.6.3/debian/patches/series  2014-07-08 18:47:50.000000000 
+0200
@@ -1,2 +1,3 @@
 editor.patch
 gnupg1-support.patch
+gpg2-no-agent.patch

Reply via email to