From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kazuhiro Ito Newsgroups: gmane.emacs.bugs Subject: bug#71500: 28.2; Can't create/open .gpg file name contains non-ascii encoding in windows Date: Sat, 29 Jun 2024 21:39:38 +0900 Message-ID: <85sewvylbp.wl--xmue@d1.dion.ne.jp> References: <86sexi1tu0.fsf@gnu.org> <867cea7shh.fsf@gnu.org> <85ikxt485b.wl--xmue@d1.dion.ne.jp> <868qyoj8id.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sat_Jun_29_21:39:38_2024-1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19173"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-w64-mingw32) MULE/6.0 (HANACHIRUSATO) Cc: billy.hotwind@gmail.com, 71500@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 29 14:40:14 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sNXNG-0004mt-5V for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Jun 2024 14:40:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNXNA-0000fI-KU; Sat, 29 Jun 2024 08:40:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNXN5-0000cM-6L for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:40:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNXN4-0000Ga-RV for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNXN4-0006tK-FP for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kazuhiro Ito Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Jun 2024 12:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71500 X-GNU-PR-Package: emacs Original-Received: via spool by 71500-submit@debbugs.gnu.org id=B71500.171966478826456 (code B ref 71500); Sat, 29 Jun 2024 12:40:02 +0000 Original-Received: (at 71500) by debbugs.gnu.org; 29 Jun 2024 12:39:48 +0000 Original-Received: from localhost ([127.0.0.1]:37358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNXMp-0006se-Fw for submit@debbugs.gnu.org; Sat, 29 Jun 2024 08:39:47 -0400 Original-Received: from mta-snd-e04.auone-net.jp ([111.86.247.4]:42720) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNXMl-0006sS-0U for 71500@debbugs.gnu.org; Sat, 29 Jun 2024 08:39:46 -0400 Original-Received: from kzhr.d1.dion.ne.jp by mta-snd-e04.auone-net.jp with ESMTP id <20240629123939319.ECO.130002.kzhr.d1.dion.ne.jp@mta-snd-e04.auone-net.jp>; Sat, 29 Jun 2024 21:39:39 +0900 In-Reply-To: <868qyoj8id.fsf@gnu.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d1.dion.ne.jp; s=default-1; t=1719664779; bh=1u0f0ZT7losv3Sx0yo21yzcheceexn5ZjcrbQNQeoME=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=B1lm2rZjVY0wGxFfNKAzH0P0PZVYO5WvZzi86aElpQ5O79VGziYNejY/wS7T62+smSGMCw3H 0QJ2Aa+K3J5jeLlmAuP7P4k2OX0dP2H9yoHTagAurgJR595vL2GO1RNbnd4Ln9dbXfO2TgzFyh 6/AZu9ZddC6NYWh3Bs3HL0yG9oEvZsiwjwoQCgBdDzP3mvNkQrpXl8RunXYDSvYCfe8+qQf4j3 Ge96y92CS9ibxMn8ABy1Xvfj+hEsb+lg8KihV6Fn9i9lBYjHsit05udIPNmurf8Bchx4B+hIht zHWqPKnKlCfsWcpON1iXx2BJIpKuW5BbPEwKli0BhVXRdpnQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288122 Archived-At: --Multipart_Sat_Jun_29_21:39:38_2024-1 Content-Type: text/plain; charset=US-ASCII > > 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? I tested attached patch and confirmed the issue was resolved. I'm not sure that :coding setting for decoding in make-process can be removed. I mean, I don't know whether Emacs can receive output from process between make-process and set-process-coding-system. -- Kazuhiro Ito --Multipart_Sat_Jun_29_21:39:38_2024-1 Content-Type: message/rfc822; name="0001-Fix-non-ASCII-filename-operatiion-on-EasyPG-bug-7150.patch" Content-Disposition: attachment; filename="0001-Fix-non-ASCII-filename-operatiion-on-EasyPG-bug-7150.patch" Content-Transfer-Encoding: 7bit From: Kazuhiro Ito Date: Sat, 29 Jun 2024 20:56:02 +0900 Subject: [PATCH] Fix non-ASCII filename operatiion on EasyPG (bug#71500) * lisp/epg.el (epg--start): Don't suppress to encode arguments for gpg2 program. --- lisp/epg.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/epg.el b/lisp/epg.el index 7bec91f616d..cf59f03c724 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -676,10 +676,11 @@ epg--start :command (cons (epg-context-program context) args) :connection-type 'pipe - :coding 'raw-text + :coding '(raw-text . nil) :filter #'epg--process-filter :stderr error-process :noquery t)))) + (set-process-coding-system process 'raw-text 'raw-text) (setf (epg-context-process context) process))) (defun epg--process-filter (process input) -- 2.45.1 --Multipart_Sat_Jun_29_21:39:38_2024-1--