[pass] bug: Pass does not handle GPG errors

Jason A. Donenfeld Jason at zx2c4.com
Sat Feb 6 21:13:33 CET 2016


Fixed upstream.


commit 4b0b6ac82f0c372405cadd921c9d5a1d9927788f
Author: Jason A. Donenfeld <Jason at zx2c4.com>
Date:   Sat Feb 6 21:14:25 2016 +0100

    Make gpg errors fatal

diff --git a/src/password-store.sh b/src/password-store.sh
index a28b128..63be840 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -380,7 +380,7 @@ cmd_insert() {
  if [[ $multiline -eq 1 ]]; then
  echo "Enter contents of $path and press Ctrl+D when finished:"
  echo
- $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" || exit 1
+ $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
|| die "Password encryption aborted."
  elif [[ $noecho -eq 1 ]]; then
  local password password_again
  while true; do
@@ -389,16 +389,16 @@ cmd_insert() {
  read -r -p "Retype password for $path: " -s password_again || exit 1
  echo
  if [[ $password == "$password_again" ]]; then
- $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
<<<"$password"
+ $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
<<<"$password" || die "Password encryption aborted."
  break
  else
- echo "Error: the entered passwords do not match."
+ die "Error: the entered passwords do not match."
  fi
  done
  else
  local password
  read -r -p "Enter password for $path: " -e password
- $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
<<<"$password"
+ $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
<<<"$password" || die "Password encryption aborted."
  fi
  git_add_file "$passfile" "Add given password for $path to store."
 }
@@ -457,7 +457,7 @@ cmd_generate() {
  local pass="$(pwgen -s $symbols $length 1)"
  [[ -n $pass ]] || exit 1
  if [[ $inplace -eq 0 ]]; then
- $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}" <<<"$pass"
+ $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile" "${GPG_OPTS[@]}"
<<<"$pass" || die "Password encryption aborted."
  else
  local passfile_temp="${passfile}.tmp.${RANDOM}.${RANDOM}.${RANDOM}.${RANDOM}.--"
  if $GPG -d "${GPG_OPTS[@]}" "$passfile" | sed $'1c \\\n'"$(sed
's/[\/&]/\\&/g' <<<"$pass")"$'\n' | $GPG -e "${GPG_RECIPIENT_ARGS[@]}"
-o "$passfile_temp" "${GPG_OPTS[@]}"; then


More information about the Password-Store mailing list