From 1ee09915d699f72e90a0d74aae827f60f0e48e8c Mon Sep 17 00:00:00 2001 From: Fredrik Salomonsson Date: Mon, 11 May 2020 16:54:25 -0700 Subject: Add missing '-input /dev/null' to rofi when asking for password (#9) When refactoring this got removed. Which hangs the input when running via gpg. It doesn't show up when running `pinentry-rofi` directly. The hang is pretty nasty as well, as input to other programs stop working. Only way is to open up a new terminal and find the PID and kill it. --- pinentry-rofi.scm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pinentry-rofi.scm b/pinentry-rofi.scm index 8b154c6..f5ab3cf 100755 --- a/pinentry-rofi.scm +++ b/pinentry-rofi.scm @@ -322,18 +322,18 @@ Return the input from the user if succeeded else #f." '())) (rofi-sh `("env" ,(string-join - (map (lambda (x) (format #f "~a=~a" (car x) (cdr x))) env)) + (map (lambda (x) (format #f "~a=~s" (car x) (cdr x))) env)) ,(format #f "rofi -dmenu -disable-history -l ~a -i" (if (list? buttons) (length buttons) 1)) ,(if (and only-match buttons) "-only-match" "") + ,(if (not buttons) "-input /dev/null" "") ,(if visibility "" "-password") ,(format #f "-p ~s" prompt) ,(if message (format #f "-mesg ~s" message) ""))) (pipe (open-pipe (string-join (concatenate `(,inputs ,rofi-sh))) OPEN_READ)) (pass (get-string-all pipe)) (status (close-pipe pipe))) - (when (and (equal? (status:exit-val status) 0) (not (string-empty? pass))) - pass))) + (if (and (equal? (status:exit-val status) 0)) pass #f))) (define (compose-message pinentry) "Create the message by combining the error and desc from PINENTRY" @@ -352,15 +352,15 @@ Return the input from the user if succeeded else #f." #:message (compose-message pinentry) #:visibility (pinentry-visibility pinentry) #:env `(("DISPLAY" . ,(pinentry-display pinentry)))))) - (if pass - (begin - (format #t "D ~a" pass) - (force-output) - (set-pinentry-ok! pinentry #t)) - (begin - (format #t "ERR 83886179 Operation cancelled \n") - (force-output) - (set-pinentry-ok! pinentry #f))))) + (if (not (string-empty? (string-trim-both pass))) + (begin + (format #t "D ~a" pass) + (force-output) + (set-pinentry-ok! pinentry #t)) + (begin + (format #t "ERR 83886179 Operation cancelled \n") + (force-output) + (set-pinentry-ok! pinentry #f))))) regex-match)) (define (pinentry-confirm pinentry line confirm-program) -- cgit