From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] On the nasty "ghost key" problem on NS Date: Sat, 05 Nov 2022 10:40:37 -0400 Message-ID: References: <87leord0ei.fsf@yahoo.com> <87h6zfchpu.fsf@yahoo.com> <394D8618-AF36-44C4-BA64-7AFDFBBDC429@gmail.com> <878rkrcbkx.fsf@yahoo.com> <87sfizaria.fsf@yahoo.com> <87k04ac3s6.fsf@yahoo.com> <87cza2b59l.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3485"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Kai Ma , emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 05 15:41:18 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 1orKMH-0000jA-HM for ged-emacs-devel@m.gmane-mx.org; Sat, 05 Nov 2022 15:41:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orKLp-0000X0-LO; Sat, 05 Nov 2022 10:40:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orKLm-0000Wd-UR for emacs-devel@gnu.org; Sat, 05 Nov 2022 10:40:46 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orKLl-0003LT-EL for emacs-devel@gnu.org; Sat, 05 Nov 2022 10:40:46 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 55BF2440F0F; Sat, 5 Nov 2022 10:40:43 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id BDF50440BF4; Sat, 5 Nov 2022 10:40:41 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1667659241; bh=sQyCBqvWEr+Oo5JsJg4+XbQlcP8Xd5XKW6z0zjeuXWQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=nH3EnvAaE0AvEWIBmQNNm8cc4D24bEM2YM4l8D0CRGF3gOpNydRPjBkxsFtFaFajS iL7Pk7wa0a/8ohX5T/wiRYF9ThrC6ZYe5P+/nhcxpazXe8jkk/KBE5X1AYT8lFW9nX eXU2cU2u7Kyt49IojUX15i2h9Uf5kVdUyYQcc9Dvg/ELmu8mTe+0RLqgMneMlh/Euv TbNmCTcKVDgp7qj3MrRl10o+YjeSDB5IMRT/UMcM/10lLeGPqnuSiiZXLOWJ86U/5k ATHUU4outEvZhmJmsgC58Ki58SyGVMb8fVwmOACWsltYQZp9PUPegSSm0GH/o8vbwx 89c9fLxgjGgyA== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 07AC5120EB6; Sat, 5 Nov 2022 10:40:40 -0400 (EDT) In-Reply-To: <87cza2b59l.fsf@yahoo.com> (Po Lu's message of "Sat, 05 Nov 2022 08:43:02 +0800") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299207 Archived-At: >> - if (WINDOWP (echo_area_window) && ! NILP (call0 (intern ("ns-in-echo-area")))) >> + was_waiting_for_input = waiting_for_input; >> + waiting_for_input = false; >> + specbind (Qinhibit_quit, Qt); >> + if (WINDOWP (echo_area_window) && ! NILP (safe_call (true, 0, Qns_in_echo_area))) >> >> I'm glad we found a way to make the code work, apparently, but >> Here we need a comment explaining why we do this gymnastic of >> `safe_call` + `inhibit_quit` + `waiting_for_input`. > > That is done all over the place in the NS code. Then why does it need to be hand-coded here? If it's done all over the place, it should have its own `super_extra_safe_call` function or something, no? > I don't really know why, you will have to ask its original authors for > that, but suffice it to say calling Lisp from > firstRectForCharacterRange (and also the menu bar update callbacks) > will otherwise crash upon Fsignal being called. Yet I don't see anything in `ns-in-echo-area` which would call `signal`. I don't mean to say that we should not protect ourselves from the case where `ns-in-echo-area` calls `signal`, but that the above explanation doesn't seem to explain the problem we're currently facing. [ And `safe_call` should be sufficient to protect ourselves from `signal`. ] Stefan