Subject: bug#33040: closed (Re: bug#33040: 26.1.50; Epg prompt on Microsoft Windows differ from the GNU/Linux on when asking passphrase)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 27 Oct 2018 09:39:02 +0000

Your bug report

#33040: 26.1.50; Epg prompt on Microsoft Windows differ from the GNU/Linux on when asking passphrase

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
33040: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33040
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#33040: 26.1.50; Epg prompt on Microsoft Windows differ from the GNU/Linux on when asking passphrase
From: Eli Zaretskii <[email-masked]>
To: [email-masked] (Pierre Téchoueyres)
Cc: [email-masked]
Date: Sat, 27 Oct 2018 12:38:07 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: [email-masked] (Pierre Téchoueyres)
> Cc: [email-masked]
> Date: Wed, 24 Oct 2018 21:21:07 +0200
> 
> Hello Eli,
> please find the patch bellow.

Thanks, pushed to the release branch.

Subject: 26.1.50; Epg prompt on Microsoft Windows differ from the GNU/Linux on when asking passphrase
From: Pierre Téchoueyres <[email-masked]>
To: [email-masked]
Date: Sun, 14 Oct 2018 17:53:50 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello everyone,
I've noticed an anoying problem when I need to decrypt a file from Emacs
on Windows. The prompt asking my passphrase is two lines whereas on
Gnu/Linux it's only one.

I've tracked this bug down to the epg--start fuction and try the
attached patch from some time now without noticing anything wrong.

The step to reproduce the bug are below:
1) Start Emacs with: emacs -Q
2) Execute the following commands in scratch buffer
   #+BEGIN_SRC emacs-lisp
(require 'epg)
(setq epg-gpg-program "gpg2"
epa-pinentry-mode 'loopback)
;; open a gnupg encrypted file :
(find-file "~/.emacs.d/authinfo.gpg")
   #+END_SRC

The result vary between Emacs on Microsoft windows and on GNU/Linux.

On Microsoft Windows:
#+BEGIN_VERSE
Passphrase for 7F4B4084DFC4EBD2 Pierre Téchoueyres <[email-masked]>
:
#+END_VERSE
Note the cariage return before the colon.

On GNU/Linux:
#+BEGIN_VERSE
Passphrase for 7F4B4084DFC4EBD2 Pierre Téchoueyres <[email-masked]>:
#+END_VERSE

>From 6e3935351b3e681fbb531818d3b2ae6db32e7b2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre=20T=C3=A9choueyres?= <[email-masked]>
Date: Sun, 14 Oct 2018 17:49:12 +0200
Subject: [PATCH] Unify prompt for gnupg passphrase between GNU/Linux and
 Windows.

* lisp/epg.el (epg--start): Use native locale coding system instead of
  binary for Microsoft Windows and DOS.
---
 lisp/epg.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/epg.el b/lisp/epg.el
index 8f26cd34ee..000366d76a 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -655,7 +655,9 @@ epg--start
 				  :command (cons (epg-context-program context)
 						 args)
 				  :connection-type 'pipe
-				  :coding '(binary . binary)
+				  :coding (if (memq system-type '(ms-dos windows-nt))
+                                              (cons locale-coding-system locale-coding-system)
+                                            '(binary . binary))
 				  :filter #'epg--process-filter
 				  :stderr error-process
 				  :noquery t)))
-- 
2.17.2

Pierre.