From 4a6fa5cbdf093d7873524fe566f58bca3761592e Mon Sep 17 00:00:00 2001 From: Nick Kousu Date: Thu, 14 Jun 2018 15:28:36 +0200 Subject: Don't trap INT or TERM; they are redundant and can break `pass edit`. Some EDITORs, notably Linux vi(1), which is the fallback default in pass, apparently send INT when they exit, and when pass is run under bash (which is also its default)--if you have /dev/shm/ available--bash catches this and cleans up your edited password file *before* it can be reencrypted and saved. This only happens with `pass edit`; none of the other commands combine tmpdir and $EDITOR. --- src/password-store.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index 0c9b35d..3f25185 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -203,7 +203,7 @@ tmpdir() { remove_tmpfile() { rm -rf "$SECURE_TMPDIR" } - trap remove_tmpfile INT TERM EXIT + trap remove_tmpfile EXIT else [[ $warn -eq 1 ]] && yesno "$(cat <<-_EOF Your system does not have /dev/shm, which means that it may @@ -218,7 +218,7 @@ tmpdir() { find "$SECURE_TMPDIR" -type f -exec $SHRED {} + rm -rf "$SECURE_TMPDIR" } - trap shred_tmpfile INT TERM EXIT + trap shred_tmpfile EXIT fi } -- cgit v1.2.3