[PATCH] Bug: Correctly set PASSWORD_STORE_DIR while running pass commands

Daniel Barreto daniel at barreto.tech
Fri Nov 4 09:22:27 UTC 2022


I noticed that since the introduction of auth-source-pass as a dependency
(3a108277637fad89869d904eea963aeb8f45b20d), the password-store-dir function
returns the value of auth-source-pass-filename which is a custom var.

The problem is that, if one customizes this value, it is only taken into account
by commands run inside auth-source-pass and not commands run by

This patch temporarily sets "PASSWORD_STORE_DIR" to the value of whatever
(password-store-dir) returns, so that the password-store-gpg process picks it up

 contrib/emacs/password-store.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 6561eb1..697a1c0 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -78,7 +78,9 @@ Kept for backward compatibility with other libraries."
 Nil arguments are ignored.  Calls CALLBACK with the output on success,
 or outputs error message on failure."
-  (let ((output ""))
+  (let ((output "")
+        (process-environment (cl-copy-list process-environment)))
+    (setenv "PASSWORD_STORE_DIR" (expand-file-name (password-store-dir)))
      :name "password-store-gpg"
      :command (cons password-store-executable (delq nil args))

base-commit: dddca73694d1ecc2381cde6c02a9d1466cf0ab41

More information about the Password-Store mailing list