GNU bug report logs - #76323
30.0.93; auth-source-pass: Annoying error when ~/.password-store doesn't exist

Previous Next

Package: emacs;

Reported by: Naofumi Yasufuku <naofumi <at> yasufuku.dev>

Date: Sun, 16 Feb 2025 05:31:02 UTC

Severity: minor

Found in version 30.0.93

Full log


Message #14 received at 76323 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <basil <at> contovou.net>
To: Naofumi Yasufuku <naofumi <at> yasufuku.dev>
Cc: 76323 <at> debbugs.gnu.org, Damien Cassou <damien <at> cassou.me>,
 "F. Jason Park" <jp <at> neverwas.me>
Subject: Re: bug#76323: 30.0.93; auth-source-pass: Annoying error when
 ~/.password-store doesn't exist
Date: Sun, 16 Feb 2025 17:47:14 +0100
Naofumi Yasufuku [2025-02-16 22:57 +0900] wrote:

> I noticed that auth-source-pass-entries is called many times
> for each search pattern

Ouch!

> I think it would be better to have just one additional dir check on
> auth-source-pass-search instead of auth-source-pass-entries.
> auth-source-pass backend just does nothing if password-store dir is not
> available.  Could it be relatively reasonable cost?

Sounds even better to me.

[ I can imagine external users of auth-source-pass-entries also
  benefitting from the filesystem guard, but I think we can leave it up
  to them to decide if/when/how they need it. ]

CCing some of the recent auth-source-pass (and ERC) contributors in case
they have any comments on the patch below.

[ The original attachment and the rest of the discussion can be found
  here: https://bugs.gnu.org/76323#11 ]

If there are no objections, I think this can be applied soon.

Yasufuku-san, do you have a copyright assignment to the FSF?
I think this contribution is still well within the limits for being
exempt, but for future contributions perhaps you would be interested in
starting the process now, if you haven't already?

> From c42a3abeb04b7c28f8532497fe9c9f0e50521a27 Mon Sep 17 00:00:00 2001
> From: Naofumi Yasufuku <naofumi <at> yasufuku.dev>
> Date: Sun, 16 Feb 2025 21:12:17 +0900
> Subject: [PATCH] auth-source-pass: Don't raise errors if ~/.password-store
>  doesn't exist
>
> * lisp/auth-source-pass.el (auth-source-pass-search):
> If auth-source-pass-filename is not a directory, just do nothing to
> avoid repeated errors raised by directory-files-recursively in
> auth-source-pass-entries which is called for each search pattern.
> (Bug#76323)
> ---
>  lisp/auth-source-pass.el | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
> index 80ddb38fa88..33786a14a87 100644
> --- a/lisp/auth-source-pass.el
> +++ b/lisp/auth-source-pass.el
> @@ -85,6 +85,9 @@ auth-source-pass-search
>          ((null host)
>           ;; Do not build a result, as none will match when HOST is nil
>           nil)
> +        ((not (file-directory-p (expand-file-name auth-source-pass-filename)))
> +         ;; Do nothing if the password-store folder doesn't exist.
> +         nil)
>          (auth-source-pass-extra-query-keywords
>           (auth-source-pass--build-result-many host port user require max))
>          (t

Thanks,
-- 
Basil




This bug report was last modified 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.