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.devel Subject: Re: master 6ed1994d27: Prevent crashes from illegal locale coding systems Date: Mon, 14 Feb 2022 05:32:19 +0200 Message-ID: <83r186p1h8.fsf@gnu.org> References: <83czjqrkew.fsf@gnu.org> <874k52kiu4.fsf@yahoo.com> <837d9yribj.fsf@gnu.org> <87v8xii83e.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3140"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Feb 14 04:33:26 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nJS7C-0000cS-9E for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Feb 2022 04:33:26 +0100 Original-Received: from localhost ([::1]:56068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJS7A-0003lr-C8 for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Feb 2022 22:33:24 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJS6A-00035s-Qo for emacs-devel@gnu.org; Sun, 13 Feb 2022 22:32:22 -0500 Original-Received: from [2001:470:142:3::e] (port=46622 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJS6A-0003Zm-E1; Sun, 13 Feb 2022 22:32:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=36/YDr63ur5aZvcgU2tPz1dlRqmq2M7jKL87NTi4w6c=; b=CsVnH8tRknIL vzzBvxAJblv/KELwuHJgM3+Hg98PoovaEKuEf8BTv/A4ksaRyKi/UkrvAubFNG9WeRYvF+jhLq9uT 3QCcY1nGKA88+aVwCW+WKErJ10eBCwJSEo78jPvpwkezFgzGDxa7xd80QbtvgAZN2G/w93O0qSF1Q QzZ8hCIdMkG+R2WAScza4PNp/0xwNvuSRB9LPR8xg3NtrNBBpdGp2eBiCJkKY9G6OrxhOu7SEpERP t9pdFgTdi3nxGwIaB4lqjCazjPsje04qDGhN9ry/R4maLXBqn+jNOmxRTq+wB9Y67pbLZoAQiYhOu z5RXBqotk1WJVBW1m3jGMQ==; Original-Received: from [87.69.77.57] (port=4732 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 1nJS69-0007Pi-QY; Sun, 13 Feb 2022 22:32:22 -0500 In-Reply-To: <87v8xii83e.fsf@yahoo.com> (message from Po Lu on Mon, 14 Feb 2022 08:51:17 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286230 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Mon, 14 Feb 2022 08:51:17 +0800 > > Eli Zaretskii writes: > > > But even nonsensical text is better than no text at all, don't you > > agree? > > > > And anyway, in what possible encodings could this text be? Can't we > > detect the encoding with reasonable success rate? > > We could try the default value of locale-coding-system That should be done in any case, I think. > > I mean, dropping input on the floor, let alone doing that silently, is > > pretty rough, no? > > It could be accompanied with a message that the locale coding system is > invalid. > > Most keyboard input isn't dropped. The only keyboard input that is is > multibyte text from input methods, so it won't affect the user's ability > to fix the locale coding system. I'd rather we tried to decode it in any way possible. We never do anything like this anywhere else where decoding is involved. > > Can't we catch those signals? > > Not within C code, I think. I don't understand why. We do that in C in many places, see the calls to internal_condition_case and its ilk. Or am I missing something?