ecraven / pinentry-emacs

a pinentry for gpg that uses emacsclient to prompt for the passphrase.
GNU General Public License v3.0
29 stars 6 forks source link

gpg: problem with the agent: Invalid IPC response #6

Open znz opened 7 years ago

znz commented 7 years ago

Call gpg without emacs, lukspinentry failed.

$ echo foo > foo
$ LANG=C gpg -c foo
gpg: problem with the agent: Invalid IPC response
gpg: error creating passphrase: Operation cancelled
gpg: symmetric encryption of 'foo' failed: Operation cancelled

Check with following diff, pinentry-curses called as pinentry-curses --ttyname not a tty. It seems tty via gpg-agent does not attach tty.

diff --git a/lukspinentry b/lukspinentry
index d6288ef..acc5635 100755
--- a/lukspinentry
+++ b/lukspinentry
@@ -28,9 +28,12 @@ if ( defined($DISPLAY) && !defined($SSH_TTY) ) {
        $pid = open2(*IN, *OUT, "pinentry-x11 -g") || die;
 } else {
        # get a tty
-       open F, "tty |" || die ("can't fork to tty");
+       open F, "env LANG=C tty |" || die ("can't fork to tty");
        my $tty = <F>;
        close F;
+open F, "> /tmp/debug" or die "debug";
+print F "pinentry-curses --ttyname $tty";
+close F;
        $pid = open2(*IN, *OUT, "pinentry-curses --ttyname $tty") || die;
 }
AnYurii commented 11 months ago

You need to start emacs daemon with M-x start-server or emacs --daemon