unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Alan Third <alan@idiocy.org>
Cc: 48902@debbugs.gnu.org, "Lars Ingebrigtsen" <larsi@gnus.org>,
	"Rudolf Adamkovič" <salutis@me.com>,
	naofumi@yasufuku.dev
Subject: bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems
Date: Wed, 9 Jun 2021 13:40:18 +0200	[thread overview]
Message-ID: <DB149BE5-05BC-4D59-BD84-480B3AD6D10A@acm.org> (raw)
In-Reply-To: <YL/T/VMaX5f1jF0K@idiocy.org>

8 juni 2021 kl. 22.33 skrev Alan Third <alan@idiocy.org>:

> It's not just allocInitFromFile, I'm looking at the other callers of
> image_find_image_file and they all call ENCODE_FILE after it too.
> 
> The only direct caller of image_find_image_fd that actually uses the
> contents of the returned string (svg_load) also encodes the file name.
> 
> So I think we could restrict the use of the encoded filename within
> image_find_image_fd to *only* when it actually opens the file.

Thank you, and I arrived at the same conclusion.

> Patch attached. I've tested it here but I only have a couple of images
> to try it with.

Looks fine, but the image_find_image_file comment needs to be amended since it says that it returns an encoded string.

> I've been looking at the other changes I made in
> 747a923b9a35533f98573ad5b01fccf096195079 and I'm not sure they're
> correct. They clearly work now, but most of the time it's probably
> simple ASCII which should pass easily.
> 
> Before they *all* seem to have assumed the data was UTF8 encoded,
> which is surely wrong since most of the time it's coming from Emacs.
> It's things like menu item titles.
> 
> These are the use cases stringWithLispString was designed for, right?
> The only odd one is image filenames because they're explicitly encoded?

I should think so -- stringWithLispString: was designed as a general-purpose method to convert from a lisp string to NSString without changing the contents. Non-Unicode values (which includes raw bytes) become U+FFFD except surrogates as they can be represented (in a manner of speaking) in UTF-16, and it turns out to be more useful that way.

Furthermore, if we use stringWithLispString: for file names, no special file name encoding step should be needed on our side, since the NS libs will perform any needed normalisation (at least if I've understood it right).






  reply	other threads:[~2021-06-09 11:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 13:32 bug#48902: 28.0.50; Directory names containing apostrophes and backticks cause problems Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-07 14:08 ` Lars Ingebrigtsen
2021-06-07 14:15   ` Eli Zaretskii
2021-06-07 14:24   ` Lars Ingebrigtsen
2021-06-07 14:36     ` Eli Zaretskii
2021-06-07 14:13 ` Eli Zaretskii
2021-06-08 22:21   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-08 10:39 ` naofumi
2021-06-08 11:57   ` Lars Ingebrigtsen
2021-06-08 12:12     ` Alan Third
2021-06-08 12:14       ` Lars Ingebrigtsen
2021-06-08 17:45         ` Mattias Engdegård
2021-06-08 18:18           ` Eli Zaretskii
2021-06-08 19:13             ` naofumi
2021-06-08 20:08               ` Mattias Engdegård
2021-06-08 19:10           ` Alan Third
2021-06-08 19:52             ` Mattias Engdegård
2021-06-08 20:33               ` Alan Third
2021-06-09 11:40                 ` Mattias Engdegård [this message]
2021-06-09 15:19                   ` Alan Third
2021-06-11 22:09                     ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-09 11:56                 ` Eli Zaretskii
2021-06-08 18:17         ` Mattias Engdegård
2021-06-08 12:37       ` Eli Zaretskii
2021-06-08 13:00         ` Alan Third
2021-06-08 14:02           ` Eli Zaretskii
2021-06-08 16:19             ` Alan Third
2021-06-08 18:09               ` Eli Zaretskii
2021-06-08 19:24                 ` Alan Third

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=DB149BE5-05BC-4D59-BD84-480B3AD6D10A@acm.org \
    --to=mattiase@acm.org \
    --cc=48902@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=larsi@gnus.org \
    --cc=naofumi@yasufuku.dev \
    --cc=salutis@me.com \
    /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).