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 #14 received at 71500 <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: 71500 <at> debbugs.gnu.org
Cc: eliz <at> gnu.org, billy.hotwind <at> gmail.com
Subject: Re: bug#71500: 28.2;
 Can't create/open .gpg file name contains non-ascii encoding in
 windows
Date: Fri, 28 Jun 2024 20:30:08 +0900
> 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

-- 
Kazuhiro Ito


> > Cc: 71500 <at> debbugs.gnu.org
> > Date: Wed, 12 Jun 2024 10:52:23 +0300
> > From: Eli Zaretskii <eliz <at> gnu.org>
> > 
> > > From: Tatsuya Kumazawa <billy.hotwind <at> gmail.com>
> > > Date: Tue, 11 Jun 2024 22:35:23 +0900
> > > 
> > > When I save .gpg file contains non-ASCII(eg: e:/あ.gpg).
> > > 
> > > I got message below
> > > (It happens anytime when user name contains non-ASCII
> > > (it must to change epg-gpg-home-directory to ASCII only path))
> > > 
> > > ----
> > > Error while encrypting with "e:/msys2/usr/bin/gpg.exe":
> > > 
> > > gpg: can't create 'c:/Users/(my name with CP932 encoded by
> > > UTF-8)/AppData/Local/Temp/epg-output9UGAFQ': No such file or directory
> > > gpg: symmetric encryption of '[stdin]' failed: No such file or directory
> > > ----
> > > 
> > > 
> > > When I open e:/あ.gpg, I got
> > > 
> > > ----
> > > Error while decrypting with "e:/msys2/usr/bin/gpg.exe":
> > > 
> > > gpg: can't open 'e:/邵コ繝サgpg': No such file or directory
> > > gpg: decrypt_message failed: No such file or directory
> > > ----
> > > 
> > > It seems UTF-8 encode by CP932 binary sequence.
> > > 
> > > share\emacs\28.2\lisp\epg.el
> > > 
> > > 673:                                                     :coding 'raw-text
> > > 
> > > to
> > > 
> > > 673:                                                     :coding
> > > '(raw-text . cp932)
> > > 
> > > (CP932 is japanese charactor code of windows)
> > > seemsly worked in my environment.
> > > 
> > > 
> > > 
> > > It might be good from cp932 to system process encoding for multilanguage?
> > 
> > There were some encoding problems in epg that were fixed recently in
> > the development sources.  Can try Emacs 30 from the master branch of
> > the Emacs Git repository and see if the problem still exists there?

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

Previous Next


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