From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: master 47b377f64b: Prevent non-local exits from ns-in-echo-area Date: Sun, 13 Nov 2022 11:07:03 +0800 Message-ID: <87tu33lfhk.fsf@yahoo.com> References: <166830147947.13137.4061439325094811374@vcs2.savannah.gnu.org> <20221113010439.BF21DC00AB5@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31536"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 13 04:07:58 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 1ou3Lh-0007zk-Bv for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Nov 2022 04:07:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ou3LB-0006EM-BP; Sat, 12 Nov 2022 22:07:25 -0500 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 1ou3L8-0006E6-1u for emacs-devel@gnu.org; Sat, 12 Nov 2022 22:07:22 -0500 Original-Received: from sonic315-22.consmr.mail.ne1.yahoo.com ([66.163.190.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ou3L6-0002k8-GI for emacs-devel@gnu.org; Sat, 12 Nov 2022 22:07:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668308837; bh=r6NW5Qs6Z/G9J0zaMzegoKIbzjY1+/5e6Mq3J9AStx8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=Os8Az715/f0a3HX4VHAdS2kMM62RfgU7FFTdyRfLxb7DrIAAFRX/A4rppLsKtrcujgChYBuNirclzFYj1VYy2lBTVL+yn3xKbXjjd45n3olLT/oOVXhHdGlFlDHwn3ynCZ6SWLhJ78TA50u0sYu3OCuEXum3ZJofz8wj4dwpMUoCLhr8ccHRiCULRjz8Ih7DjPb+xdQ1uURuKCpO8D0z5x5fi3T9s0BdRoWT94hh8n3FoWHoSxQsyd7SEREyHDcgNSrXZgQQxPm2fsZcVcubFPl05+nsJINRYzlAXHhusJw1df3Ap8cw6QQLKkUJ9UMw0uZa3L2vLvIC0eZwrUmXjw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668308837; bh=VpNbueK5db7Kt4E2ZvjRsIwknVIfDDN/gsmuRISswPo=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=CFwO0TBDE44gSNdUIYSJzpyVO8Jrd6S1E4rkuotGL6M8wyMPnRZiUraGUSdxAUiykRmwYeGs0x15ECoIxhlkGx4pPBphzjYXXxe3FGFlvMi/u1Sc32X3Onuejc5y8zt4fkf+8Or2LnjWvTnsvlY87d4ESP8Cm914/e9k03twZ0t90zAImsGMwrmZuhsFRx/d61XtGrqZimM9GSYn6w3fi3ZDK+U/9MfypTxyoTDmFjccbi1B8sTnIbekNSkTD3tXhrIGRp5zPyeeS5ISpop0eDMVMkkZcEWSkJDu+fI9024z3w4Y73nurT9S0iwR1X0QSyAWJWO7P1jAsYz5wAKvCw== X-YMail-OSG: NC4AC.sVM1l.ZZJRrRproZEEriCjQ1I_Vdr3znbju6x9gJ3EBkKEfWtzCKpWfRu 9qMUWAiisoYtP0IbdESpIENJpJCkvlhOtjetybN0hykqgPJb169RtK04B4cixdi30JPtPwhZ2iyu gI.t_B6dQ9.qtSd6oZ4QtBa59zc2YLNYJnNI0DaKwpltfrujvGS7jqhBbTWpXYRx9Bh5lcpsE47K 673IV2eG2Q9i85VBjkd3HlViMtDpskIEBUp7FLL2bM2b5cvisXtaI7d9ugCSGWB9vJsafQiVOWIb oTRjOWdNWYNAki8tmEOKl77XEWe9d_35E9n2dQFU3U6mc9Bdq90Ut166nkGSJHtnE_tnsg62Eohc f3l39DcQ62fYKph7g5WCJL1id2Cim0Kh13FLEMEtU9OmQJ4AgNF2dFNo8fu2TTN7F94G4eXB4P9P Z2TIVPBduqItLMqUI96d78SgrYQmEPrM62aiArO.TXy_l2OaZQTBxOxbbcgVwCbEEQAVjC3MYx.3 2lqG6PG9aOtenv979pVPIRV8lQSyZQesuFlrQfZajA0kNPk_cJkgy6PkRGjr1.8y0KNJIIMCRxTI 9wR2_zngZfNLs6sj4_x9hulslz6vEmdDxwkj9oylfDz7p0.9.ttc.KUfV4gOcIbcKoc9.QZpFzNP 3JupRMFilmWnlOLJHQ9CHodHI_wdM3YP7as.XJGirVS1S1yYUuUSZHO6Q0l0fPb2i0x6tj4WGGjV nyJGTS6FJ7EJFsGlPS5RW9Z1hW.YIgXV3KTR7hux4e4QNxML2qJI.5Yjwp1d.bRRtYyfdxvJPoV6 XLEMTCDMXxMO4cCpj_k1HxyJLQkuBkSN7SM6IRB5bm X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Sun, 13 Nov 2022 03:07:17 +0000 Original-Received: by hermes--production-sg3-6c8895b545-phbzr (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 1bc53d268c02c8a6c17919a774c13910; Sun, 13 Nov 2022 03:07:10 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Sat, 12 Nov 2022 20:52:40 -0500") X-Mailer: WebService/1.1.20826 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.190.148; envelope-from=luangruo@yahoo.com; helo=sonic315-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299692 Archived-At: Stefan Monnier writes: > Hmm... this still looks like an ugly hack, and still without any > comments explaining why we're doing it. > > E.g. why do we need `safe_call` in addition to `internal_catch_all`? > If we're using `safe_call`, why not use that code's handling of > `inhibit_quit` and write our own around it instead? safe_call binds inhibit-redisplay to t. > AFAICT we don't *really* know why we need `internal_catch_all` or > `inhibit-quit` and even less if/why we need both. We need both because throw-on-input can otherwise cause the code inside to throw, and as Gerd found out earlier it is not safe to call redisplay inside an NS input callback. Besides, it's Lisp, so a user could plausibly shoot himself in the foot by advising that function. I would rather write the entirety in C (see the calls to xic_set_preeditarea in xterm.c), but I have no idea how input methods work on NS. > And we don't know what we *should* do if this code signals a weird > error or `throw`s, really (currently, we just silently drop the > error/throw, but maybe we should arrange for it to be "recreated" > elsewhere). I don't know either, but it's better than having Lisp longjmp out of the NS code. > I'm not in a position to dig any further, and it looks like noone here > is either, but *please* add a comment explaining as much as you can > about what we know now, so as to help the future guy who wants to try > and figure it out (or so as to avoid re-introducing the problem when > someone stumbles upon this weird code full of redundant protections and > figures it can be simplified). Okay. How about: Use safe_call so redisplay is inhibited, and internal_catch_all so that the likes of `throw-on-input' or user advice can not cause a non-local exit out of the Lisp function being called, both of which are unsafe inside NS input callbacks.