From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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 15:55:38 +0300 Message-ID: <86plrzj4c5.fsf@gnu.org> References: <86sexi1tu0.fsf@gnu.org> <867cea7shh.fsf@gnu.org> <85ikxt485b.wl--xmue@d1.dion.ne.jp> <868qyoj8id.fsf@gnu.org> <85sewvylbp.wl--xmue@d1.dion.ne.jp> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20123"; mail-complaints-to="usenet@ciao.gmane.io" Cc: billy.hotwind@gmail.com, 71500-done@debbugs.gnu.org To: Kazuhiro Ito Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 29 14:56:35 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 1sNXd4-00054c-Mu for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Jun 2024 14:56:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNXcf-0006vl-Ko; Sat, 29 Jun 2024 08:56: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 1sNXcY-0006uN-QD for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:56:02 -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 1sNXcY-0001zg-HD for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNXcY-0007LR-6p for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 08:56:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Jun 2024 12:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 71500 X-GNU-PR-Package: emacs Mail-Followup-To: 71500@debbugs.gnu.org, eliz@gnu.org, billy.hotwind@gmail.com Original-Received: via spool by 71500-done@debbugs.gnu.org id=D71500.171966575028211 (code D ref 71500); Sat, 29 Jun 2024 12:56:01 +0000 Original-Received: (at 71500-done) by debbugs.gnu.org; 29 Jun 2024 12:55:50 +0000 Original-Received: from localhost ([127.0.0.1]:37416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNXcL-0007Kx-GG for submit@debbugs.gnu.org; Sat, 29 Jun 2024 08:55:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNXcJ-0007Kh-Sl for 71500-done@debbugs.gnu.org; Sat, 29 Jun 2024 08:55:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNXcD-0001yL-HC; Sat, 29 Jun 2024 08:55:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VVTOiSa+TFF3SEXvz+TmUCljNY40Has0RyYSjpYcFFM=; b=kGyg7E2izjU+ sNZdliCL4nzAL0MzHIntAraObAarzeYNsyn9tZka7B71zrcMWVrbtH6RA+h7ZKkAfChjSU00i2J1g 8dEzhUvZcgNAJY53SRg8rYSakxBTnjNPo1urOy4ZEZELVkVU+Lix0CfAXUpdbnyFrkMgm6l3X129b p65H0wak0tnDQcOIlS8rlgI9yOaVNK+k8M7CxQODNMbb/KLX382tcxiSpzr8ApI1A+l3ZCpr+8KQO Uyg/KwP+EUaFxDj0DNRCCW7pcGjVKnWoyHaoKL/mkxHcNeHk4dih/GaEUG0YktSDP6XRjyioqCZaI wBjuWb9PilVKd8nt+cqURg==; In-Reply-To: <85sewvylbp.wl--xmue@d1.dion.ne.jp> (message from Kazuhiro Ito on Sat, 29 Jun 2024 21:39:38 +0900) 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:288127 Archived-At: > Date: Sat, 29 Jun 2024 21:39:38 +0900 > From: Kazuhiro Ito > Cc: 71500@debbugs.gnu.org, > billy.hotwind@gmail.com > > > > 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. Thanks, installed on the emacs-30 release branch, and closing the bug. > 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. Emacs is a single-threaded program, so until epg--start returns, no output can be received and decoded by Emacs from the gpg sub-process. So this is safe.