From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems Date: Tue, 8 Jun 2021 14:00:17 +0100 Message-ID: References: <51cb-60bf4900-1dd-2840bc80@23790836> <875yyoo9gy.fsf@gnus.org> <834ke8fs68.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36836"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48902@debbugs.gnu.org, larsi@gnus.org, salutis@me.com, naofumi@yasufuku.dev To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 08 15:01:40 2021 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 1lqbMS-0009PJ-Dm for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 15:01:40 +0200 Original-Received: from localhost ([::1]:33070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqbMQ-0005ec-Ft for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 09:01:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqbLq-0005aQ-KD for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 09:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqbLp-0000VO-QJ for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 09:01:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lqbLp-0006NA-JY for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 09:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Jun 2021 13:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48902 X-GNU-PR-Package: emacs Original-Received: via spool by 48902-submit@debbugs.gnu.org id=B48902.162315722824447 (code B ref 48902); Tue, 08 Jun 2021 13:01:01 +0000 Original-Received: (at 48902) by debbugs.gnu.org; 8 Jun 2021 13:00:28 +0000 Original-Received: from localhost ([127.0.0.1]:57653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqbLI-0006MF-Gs for submit@debbugs.gnu.org; Tue, 08 Jun 2021 09:00:28 -0400 Original-Received: from [217.169.17.33] (port=51406 helo=breton.holly.idiocy.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqbLE-0006Lx-E9 for 48902@debbugs.gnu.org; Tue, 08 Jun 2021 09:00:27 -0400 Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 28649202C69DF9; Tue, 8 Jun 2021 14:00:17 +0100 (BST) Mail-Followup-To: Alan Third , Eli Zaretskii , larsi@gnus.org, naofumi@yasufuku.dev, 48902@debbugs.gnu.org, salutis@me.com Content-Disposition: inline In-Reply-To: <834ke8fs68.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:208234 Archived-At: On Tue, Jun 08, 2021 at 03:37:51PM +0300, Eli Zaretskii wrote: > > Date: Tue, 8 Jun 2021 13:12:56 +0100 > > From: Alan Third > > Cc: 48902@debbugs.gnu.org, Rudolf Adamkovič , > > naofumi@yasufuku.dev > > > > On Tue, Jun 08, 2021 at 01:57:01PM +0200, Lars Ingebrigtsen wrote: > > > naofumi@yasufuku.dev writes: > > > > > > > diff --git a/src/nsimage.m b/src/nsimage.m > > > > index fa81a41a51..8c7a3d9a09 100644 > > > > --- a/src/nsimage.m > > > > +++ b/src/nsimage.m > > > > @@ -262,7 +262,7 @@ + (instancetype)allocInitFromFile: (Lisp_Object)file > > > > found = ENCODE_FILE (found); > > > > > > > > image = [[EmacsImage alloc] initByReferencingFile: > > > > - [NSString stringWithLispString: found]]; > > > > + [NSString stringWithUTF8String: SSDATA (found)]]; > > > > > > Hm... I'm not very familiar at all with the Objective C code here... > > > but shouldn't "found" here be a Lisp string so that stringWithLispString > > > would do the right thing? > > > > It's always possible that stringWithLispString isn't doing the right > > thing. It's implemented at nsfns.m:3026. I know almost nothing about > > UTF8/UTF16 so while it looks like it's doing the right thing to me, I > > could be entirely wrong. > > It looks like stringWithLispString encodes into UTF-16? But file > names on macOS should be encoded in UTF-8, and in fact > allocInitFromFile already does TRT when it calls ENCODE_FILE, just > before stringWithLispString is called. So I think the patch is > correct. > > (UTF-16 encoding on macOS is for ENCODE_SYSTEM, right?) I think you're right. But confusingly initByReferencingFile takes an NSString which is a UTF-16 format string, so if I remove all the calls to ENCODE_FILE, stringWithLispString works fine. I guess we just need to make a note that stringWithLispString cannot handle UTF-8 encoded filenames, unless someone has a smarter solution. -- Alan Third