[PATCH] emacs: fix infloop in password-store--run

Tino Calancha tino.calancha at gmail.com
Mon Feb 28 21:15:52 UTC 2022



On Sun, 27 Feb 2022, Kai Tetzlaff wrote:

Hi Kai,

thank you very much for your report and the patches!

> I found that certain commands (like password-store--run-generate,
> password-store--run-remove) cause an infloop in:

> The problem is the `(while (not output) (sleep-for .1))` loop which
> never receives any output (from the supposedly asynchronous pass process
> started via `password-store--run-1').

I have no way to test Windows from here.
Could you check if you still see the issue with the following patch?

--8<-----------------------------cut here---------------start------------->8---

>From 00eaff37e6cff555857cc436967c7449d4269deb Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha at gmail.com>
Date: Mon, 28 Feb 2022 21:56:23 +0100
Subject: [PATCH] emacs: Check `process-status' in the sentinel

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

diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index 61c339e..62239dd 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -88,9 +88,9 @@ or outputs error message on failure."
                 (setq output (concat output text)))
       :sentinel (lambda (process state)
                   (cond
-                  ((string= state "finished\n")
+                  ((and (eq (process-status process) 'exit) (zerop (process-exit-status process)))
                     (funcall callback output))
-                  ((string= state "open\n") (accept-process-output process))
+                  ((eq (process-status process) 'run) (accept-process-output process))
                    (t (error (concat "password-store: " state))))))))

  (defun password-store--run (&rest args)
-- 
2.30.2

--8<-----------------------------cut here---------------end--------------->8---


More information about the Password-Store mailing list