Subject: bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory

From: Stefan Kangas <[email-masked]>
Date: Sun, 6 Oct 2019 04:07:46 +0200

"John Wiegley" <[email-masked]> writes:

> `auth-source-pass-entries' is defined as follows:
>
>   (defun auth-source-pass-entries ()
>     "Return a list of all password store entries."
>     (let ((store-dir (expand-file-name "~/.password-store/")))
>       (mapcar
>        (lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
>        (directory-files-recursively store-dir "\.gpg$"))))
>
> However, the pass utility does not require that this be the directory where
> passwords are stored. This should be a customizable variable, initialized from
> the value of (getenv "PASSWORD_STORE_DIR") if set.

Hi John,

I see that an option was added recently which takes care of the first
part of your requesti:

a63cbb56df 2019-01-13 Add auth-source-pass-filename option

I've attached a patch which initializes auth-source-pass-filename to
(getenv "PASSWORD_STORE_DIR") when it's set.  What do you think?

Best regards,
Stefan Kangas
From 2bb16aaa577fe45f7ed18cb84413c53a4c0daea2 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Sun, 6 Oct 2019 04:02:27 +0200
Subject: [PATCH] Use PASSWORD_STORE_DIR in auth-source-pass when set

* lisp/auth-source-pass.el (auth-source-pass-filename): Initialize to
PASSWORD_STORE_DIR environment variable when set.  (Bug#29663)
---
 lisp/auth-source-pass.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index c45c782c27..524a72792c 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -45,7 +45,8 @@ auth-source-pass
   :group 'auth-source
   :version "27.1")
 
-(defcustom auth-source-pass-filename "~/.password-store"
+(defcustom auth-source-pass-filename
+  (or (getenv "PASSWORD_STORE_DIR") "~/.password-store")
   "Filename of the password-store folder."
   :type 'directory
   :version "27.1")
-- 
2.20.1