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#56469: 29.0.50; Unibyte dir in directory_files_internal Date: Sat, 09 Jul 2022 21:17:22 +0300 Message-ID: <83y1x2177x.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="832"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56469@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 09 20:18:13 2022 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 1oAF1x-000Abw-15 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 20:18:13 +0200 Original-Received: from localhost ([::1]:44686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAF1v-0000SE-Dr for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 14:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAF1m-0000Ru-QH for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 14:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41999) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAF1m-0001Fq-F1 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 14:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oAF1m-0000y2-BM for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 14:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jul 2022 18:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56469 X-GNU-PR-Package: emacs Original-Received: via spool by 56469-submit@debbugs.gnu.org id=B56469.16573906663697 (code B ref 56469); Sat, 09 Jul 2022 18:18:02 +0000 Original-Received: (at 56469) by debbugs.gnu.org; 9 Jul 2022 18:17:46 +0000 Original-Received: from localhost ([127.0.0.1]:35896 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAF1W-0000xY-6v for submit@debbugs.gnu.org; Sat, 09 Jul 2022 14:17:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAF1U-0000xL-Da for 56469@debbugs.gnu.org; Sat, 09 Jul 2022 14:17:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAF1O-0001Ar-KU; Sat, 09 Jul 2022 14:17:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=RfwzcQKeoXWbvp7Rbd/zo9oto7d1hhInTQEZC1XINeU=; b=KVWZNO2C3MuNA8928FQt CwX6HVblbInulsStmUhcsfm7lR2QaDreTgsxfWzd2SJ3UcNnajS/JlXpqH5gHRcs1a607k8uBE9tD 8aU3z/44QchYRjKIuADowXuNKH8UtC7IjjV+aHvfeifj4F7ImaYNsdl8l/gN/WnxO6zekOZO7kDo0 QIadFoxncG5rFahRuSgX/dDGMbMdSVtVnI26AMrFWFgZW0lmJ5hhrJjdq4tVMC4F/G79Sc6t8ubWl A1gwQopWKNWjQdcOG15SyhCvVj1k2Adyld1VHM10+PLOxQybRJe6b+GKqLcnSK4gff0hT2frrMFSE WN4HONaLs0wC3Q==; Original-Received: from [87.69.77.57] (port=3563 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAF1O-0003sY-3d; Sat, 09 Jul 2022 14:17:38 -0400 In-Reply-To: (bug-gnu-emacs@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:236530 Archived-At: > Date: Sat, 09 Jul 2022 13:44:52 -0400 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > If you have a directory named "/tmp/\303a" with a file named "fée" > inside, then (directory-files "/tmp/\303a" 'full) is likely to return > a funny string which is multibyte but contains an invalid > utf-8 sequence (its bytes spell "/tmp/\303a/f\303\251e"). > That strings seems to be printed as "/tmp/¡/fée" which corresponds > to "/tmp/\303\241/f\303\251e". > > Such a string with an invalid UTF-8 sequence is handled quite graciously > by Emacs, so I wasn't able to get an actual crash out of it, but it's > still something we should avoid. > > I suggest the patch below. In a comment I suggest we don't try to use > unibyte strings when a multibyte string would work as well. This is > because for those ASCII-only strings, it's cheaper to test bytes==chars > to (re)discover that they are ASCII-only (when they're multibyte) than > having to loop through the bytes (when they're unibyte). Please bootstrap Emacs in a directory with such a name, and if that works, I'm okay with installing this change. Thanks.