aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam W <sam@wlcx.cc>2021-06-27 00:57:48 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-09-23 23:31:03 +0200
commit04cd3023f48cd203f6c0193e57a427226e8b431c (patch)
treec21821c4e8780b70cb3e2cd59461a459ecea050e
parentfde8baea4c7886237ef5acc26a18a9ecbb97c432 (diff)
downloadpass-04cd3023f48cd203f6c0193e57a427226e8b431c.tar.zst
Fix unecessary reencryptions on MacOS
POSIX sed doesn't support \+ in BREs which causes the regex that extracts a file's current keys to return nothing, meaning that files are unecessarily reencrypted. This converts the regex in question to use ERE.
-rwxr-xr-xsrc/password-store.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 48f92e1..aef8d72 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -129,7 +129,7 @@ reencrypt_path() {
done
gpg_keys="$($GPG $PASSWORD_STORE_GPG_OPTS --list-keys --with-colons "${GPG_RECIPIENTS[@]}" | sed -n 's/^sub:[^idr:]*:[^:]*:[^:]*:\([^:]*\):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[a-zA-Z]*e[a-zA-Z]*:.*/\1/p' | LC_ALL=C sort -u)"
fi
- current_keys="$(LC_ALL=C $GPG $PASSWORD_STORE_GPG_OPTS -v --no-secmem-warning --no-permission-warning --decrypt --list-only --keyid-format long "$passfile" 2>&1 | sed -n 's/^gpg: public key is \([A-F0-9]\+\)$/\1/p' | LC_ALL=C sort -u)"
+ current_keys="$(LC_ALL=C $GPG $PASSWORD_STORE_GPG_OPTS -v --no-secmem-warning --no-permission-warning --decrypt --list-only --keyid-format long "$passfile" 2>&1 | sed -nE 's/^gpg: public key is ([A-F0-9]+)$/\1/p' | LC_ALL=C sort -u)"
if [[ $gpg_keys != "$current_keys" ]]; then
echo "$passfile_display: reencrypting to ${gpg_keys//$'\n'/ }"