unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 56469@debbugs.gnu.org
Subject: bug#56469: 29.0.50; Unibyte dir in directory_files_internal
Date: Sat, 09 Jul 2022 21:17:22 +0300	[thread overview]
Message-ID: <83y1x2177x.fsf@gnu.org> (raw)
In-Reply-To: <jwvy1x2p4dn.fsf@iro.umontreal.ca> (bug-gnu-emacs@gnu.org)

> 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" <bug-gnu-emacs@gnu.org>
> 
> 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.





  reply	other threads:[~2022-07-09 18:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09 17:44 bug#56469: 29.0.50; Unibyte dir in directory_files_internal Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-09 18:17 ` Eli Zaretskii [this message]
2022-07-09 18:20   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-09 18:53     ` Eli Zaretskii
2022-07-10 14:23   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-10 14:32     ` Eli Zaretskii
2022-07-10 14:58       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-10 15:07         ` Eli Zaretskii
2022-07-10 15:19           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-10 15:41             ` Eli Zaretskii
2022-07-10 22:13               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-11  2:27                 ` Eli Zaretskii
2022-09-05 19:21               ` Lars Ingebrigtsen
2022-09-07 13:32                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y1x2177x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56469@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).