bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24206: 25.1; Curly quotes generate invalid strings, leading to a seg


From: Eli Zaretskii
Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault
Date: Mon, 15 Aug 2016 21:51:37 +0300

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Paul Eggert <eggert@cs.ucla.edu>,  p.stephani2@gmail.com,  johnw@gnu.org, 
>  nicolas@petton.fr,  24206@debbugs.gnu.org
> Date: Mon, 15 Aug 2016 18:46:19 +0200
> 
> Unibyte strings should not be used for anything but pre-decoding /
> post-encoding situations directly after / before doing the actual I/O
> operation.  Thus substitute-command-keys should never be called with an
> undecoded unibyte string.  IMHO it would be ok to return something
> useless in this case (but it shouldn't cause Emacs to crash, of course).

I mostly agree, but there's one situation where the above cannot hold:
during startup, before Emacs sets up its encoding/decoding machinery
and defaults, and decodes the relevant variables (such as load-path)
after that.  Until that is done, we cannot have multibyte strings in
Emacs, because we don't know how to decode them.  During that short
period, Emacs still calls various primitives that manipulate strings,
and they need to work with unibyte strings, because Emacs must be able
to start up in directories with non-ASCII names.

Granted, substitute-command-keys are not supposed to be called during
that period.  Or at least I think so.  But who knows?  We definitely
call it when we construct the menu-bar menus, and some user could
perhaps cause it to be called in some startup hook.

So I'm okay with changing the output for unibyte strings on master,
but I think emacs-25 should not produce multibyte strings from
substitute-command-keys more eagerly than previous versions.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]