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 17:19:44 +0100 Message-ID: References: <51cb-60bf4900-1dd-2840bc80@23790836> <875yyoo9gy.fsf@gnus.org> <834ke8fs68.fsf@gnu.org> <83zgw0e9ou.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38768"; 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 18:20:13 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 1lqeSa-0009qq-1a for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 18:20:12 +0200 Original-Received: from localhost ([::1]:36962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqeSY-0002PD-6k for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 12:20:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqeSR-0002P5-2c for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 12:20:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqeSQ-0007w9-RI for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 12:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lqeSQ-0005k4-Hy for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 12:20:02 -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 16:20:02 +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.162316920022059 (code B ref 48902); Tue, 08 Jun 2021 16:20:02 +0000 Original-Received: (at 48902) by debbugs.gnu.org; 8 Jun 2021 16:20:00 +0000 Original-Received: from localhost ([127.0.0.1]:59600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqeSK-0005jf-M1 for submit@debbugs.gnu.org; Tue, 08 Jun 2021 12:20:00 -0400 Original-Received: from outbound.soverin.net ([116.202.65.218]:53945) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqeSJ-0005jS-0X for 48902@debbugs.gnu.org; Tue, 08 Jun 2021 12:19:56 -0400 Original-Received: from smtp.soverin.net (unknown [10.10.3.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id A70C56062D; Tue, 8 Jun 2021 16:19:48 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [159.69.232.138]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1623169187; bh=j8l7UtSgsvxdT+0w0utHfOEb3y9KSBB4j1DGlOJivzQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HfB9A2vkZ4nCYHPqNvoxPkH9H8GdAH6Arb2HAcpku835liq7h1U3z/RhkgNpDaNP6 MoU5Pm0ycTdt2fpeYc/HBUyRAPnNqoMWNVoHwl/t+VIjrWAzMbV4VeUFmvgAOvZS4A idZJ+cnsPxt9lKHqO5elC+EeMrGJhLT6k1VDawRNgobBaPZJF4VMupW11U/DN1YGF3 nMm+0yGH5t1lQvgrapbTnA9R7VZO9gfShsfr8INOqDZXf+ptj8ZB6sJVzImFTsegBA 88F7L+b4XAjyHUjWy3inBiX2LCkSC+pLPV+Eop0phXQiyrxtz97/VlgNFiQFCZ26Fx X8a2wRu89gGhQ== Original-Received: from alan by faroe.holly.idiocy.org with local (Exim 4.94.2) (envelope-from ) id 1lqeS8-001B2Z-MR; Tue, 08 Jun 2021 17:19:44 +0100 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: <83zgw0e9ou.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:208249 Archived-At: On Tue, Jun 08, 2021 at 05:02:25PM +0300, Eli Zaretskii wrote: > > Date: Tue, 8 Jun 2021 14:00:17 +0100 > > From: Alan Third > > Cc: larsi@gnus.org, naofumi@yasufuku.dev, 48902@debbugs.gnu.org, > > salutis@me.com > > > > > 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. > > If you do need a UTF-16 encoded string, then instead of ENCODE_FILE > you can call code_convert_string_norecord with Qutf_16. There's no > need to invent or use a private UTF-16 encoder there, and you also get > rid of an unnecessary extra UTF-8 encoding as a bonus. In this case the call to ENCODE_FILE in allocInitFromFile is actually redundant because image_find_image_fd already calls ENCODE_FILE on the filename before passing it back. So we get a UTF-8 string no matter what. NSString can read in almost anything, and Mattias extended it to read in multibyte (and ascii) lisp strings, so we don't need a UTF-16 input specifically. It would probably be nice if NSString was also able to recognise that a lisp string is UTF-8 and handle that itself, but I don't think that's really possible, unless we make the assumption that any unibyte string it's passed will already be ascii or UTF-8. I don't know if that's a reasonable assumption. -- Alan Third