GNU bug report logs - #71500
28.2; Can't create/open .gpg file name contains non-ascii encoding in windows

Previous Next

Package: emacs;

Reported by: Tatsuya Kumazawa <billy.hotwind <at> gmail.com>

Date: Wed, 12 Jun 2024 04:45:02 UTC

Severity: normal

Found in version 28.2

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: billy.hotwind <at> gmail.com, 71500 <at> debbugs.gnu.org
Subject: Re: bug#71500: 28.2;
 Can't create/open .gpg file name contains non-ascii encoding in
 windows
Date: Sat, 29 Jun 2024 14:25:30 +0300
> Date: Fri, 28 Jun 2024 20:30:08 +0900
> From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
> Cc: billy.hotwind <at> gmail.com, eliz <at> gnu.org
> 
> > Ping!  Did you have a chance to try Emacs 30 (now on the emacs-30
> > branch of the Emacs Git repository)?
> 
> Unfortunately, the issue is not resolved.
> 
> As Tatsuya wrote, epg--start function calls gpg2 program with setting
> :coding property to raw-text, thus each argument should be encoded in
> proper coding system by a caller.  The problem would occur on any OS
> whose file name coding system was not utf-8.
> 
> For example, in case of epg-decrypt-file, following change is required
> if we need to set :coding property to raw-text for ENCODING.
> 
> diff --git a/lisp/epg.el b/lisp/epg.el
> index 7bec91f616d..59870761565 100644
> --- a/lisp/epg.el
> +++ b/lisp/epg.el
> @@ -1468,7 +1468,10 @@ epg-decrypt-file
>        (progn
>  	(setf (epg-context-output-file context)
>                (or plain (make-temp-file "epg-output")))
> -	(epg-start-decrypt context (epg-make-data-from-file cipher))
> +	(epg-start-decrypt context
> +                           (epg-make-data-from-file
> +                            (encode-coding-string
> +                             cipher file-name-coding-system)))
>  	(epg-wait-for-completion context)
>  	(epg--check-error-for-decrypt context)
>  	(unless plain

Thanks, but this doesn't look right to me.  The problem is likely in
the fact that epg--start sets the encoding/decoding for the epg
process to raw-text in a way that is too broad: it affects not only
how we encode and decode text sent to and received from GnuPG, but
also how its command-line arguments are encoded.  And that's not what
we want.

So I think the right fix is in epg--start: instead of setting :coding
as part of the make-process call, it should call
set-process-coding-system _after_ the make-process call, so that
raw-text will affect only the text we send and receive from gpg.

Can you try such a change and see if it fixes the problem?




This bug report was last modified 1 year and 21 days ago.

Previous Next


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