[pass] [PATCH 2/5] prevent <ctrl-c> on password entry from wiping out file

Brian Mattern rephorm at rephorm.com
Thu Sep 13 07:24:20 CEST 2012


Currently, if you hit ctrl-c at the standard 'Enter password' prompt,
since it is piped directly to gpg, the entry gets cleared. Trying to
read from that entry results in:

  gpg: [don't know]: 1st length byte missing

This patch fixes this.

---
 src/password-store.sh |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index ad8f8ce..e21ec69 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -222,7 +222,8 @@ case "$command" in
 			done
 		else
 			echo -n "Enter password for $path: "
-			head -n 1 | gpg -q -e -r "$ID" -o "$passfile" --yes
+			read password
+			gpg -q -e -r "$ID" -o "$passfile" --yes <<<"$password"
 		fi
 		if [[ -d $GIT ]]; then
 			git add "$passfile"
-- 
1.7.9.5





More information about the Password-Store mailing list