From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24206: 25.1; Curly quotes generate invalid strings, leading to a segfault Date: Mon, 15 Aug 2016 21:51:37 +0300 Message-ID: <83mvkdg91i.fsf@gnu.org> References: <8337m7h1dp.fsf@gnu.org> <83zioffew5.fsf@gnu.org> <83popaf1yz.fsf@gnu.org> <87bn0u3rqc.fsf@linux-m68k.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1471287205 17994 195.159.176.226 (15 Aug 2016 18:53:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 15 Aug 2016 18:53:25 +0000 (UTC) Cc: p.stephani2@gmail.com, eggert@cs.ucla.edu, nicolas@petton.fr, johnw@gnu.org, 24206@debbugs.gnu.org To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 15 20:53:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZN0i-0004TS-7K for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 Aug 2016 20:53:20 +0200 Original-Received: from localhost ([::1]:38493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZN0f-0001iV-CJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 Aug 2016 14:53:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZN0V-0001aD-NZ for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2016 14:53:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZN0Q-0000YI-K2 for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2016 14:53:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZN0Q-0000YE-Gb for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2016 14:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bZN0Q-0003dK-Bw for bug-gnu-emacs@gnu.org; Mon, 15 Aug 2016 14:53: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: Mon, 15 Aug 2016 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24206-submit@debbugs.gnu.org id=B24206.147128714513920 (code B ref 24206); Mon, 15 Aug 2016 18:53:02 +0000 Original-Received: (at 24206) by debbugs.gnu.org; 15 Aug 2016 18:52:25 +0000 Original-Received: from localhost ([127.0.0.1]:58535 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZMzp-0003cS-2j for submit@debbugs.gnu.org; Mon, 15 Aug 2016 14:52:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZMzn-0003cD-LD for 24206@debbugs.gnu.org; Mon, 15 Aug 2016 14:52:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZMze-0000U4-C6 for 24206@debbugs.gnu.org; Mon, 15 Aug 2016 14:52:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38897) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZMzZ-0000Tk-OY; Mon, 15 Aug 2016 14:52:09 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2009 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bZMzV-0006bj-M8; Mon, 15 Aug 2016 14:52:08 -0400 In-reply-to: <87bn0u3rqc.fsf@linux-m68k.org> (message from Andreas Schwab on Mon, 15 Aug 2016 18:46:19 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122251 Archived-At: > From: Andreas Schwab > Cc: Paul Eggert , 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.