From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#40088: 27.0.90; =?UTF-8?Q?Symbol=E2=80=99s?= value as variable is void: debugger-outer-match-data Date: Sun, 22 Mar 2020 16:25:17 +0200 Message-ID: <83mu88cvqq.fsf@gnu.org> References: <87lfo0eddw.fsf@fastmail.fm> <87y2rz94m5.fsf@web.de> <874kun6wam.fsf@gmail.com> <87sgi55hw7.fsf@gmail.com> <87d097l8v6.fsf@gmail.com> <83r1xne753.fsf@gnu.org> <874kuhl18k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="20750"; mail-complaints-to="usenet@ciao.gmane.io" Cc: michael_heerdegen@web.de, joostkremers@fastmail.fm, 40088@debbugs.gnu.org, monnier@iro.umontreal.ca To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 22 15:26:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jG1YO-0005IR-7v for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 15:26:16 +0100 Original-Received: from localhost ([::1]:46718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jG1YN-0007H9-AE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 10:26:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59699) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jG1YB-0007Gw-Qy for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 10:26:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jG1YA-0008Pz-KW for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 10:26:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44839) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jG1YA-0008Pu-Go for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 10:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jG1YA-0000Jt-EH for bug-gnu-emacs@gnu.org; Sun, 22 Mar 2020 10:26: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: Sun, 22 Mar 2020 14:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40088 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40088-submit@debbugs.gnu.org id=B40088.15848871241170 (code B ref 40088); Sun, 22 Mar 2020 14:26:02 +0000 Original-Received: (at 40088) by debbugs.gnu.org; 22 Mar 2020 14:25:24 +0000 Original-Received: from localhost ([127.0.0.1]:50811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG1XY-0000Im-7M for submit@debbugs.gnu.org; Sun, 22 Mar 2020 10:25:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jG1XW-0000IX-S9 for 40088@debbugs.gnu.org; Sun, 22 Mar 2020 10:25:23 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jG1XR-0008Cm-EM; Sun, 22 Mar 2020 10:25:17 -0400 Original-Received: from [176.228.60.248] (port=4174 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jG1XQ-0000xQ-7J; Sun, 22 Mar 2020 10:25:16 -0400 In-Reply-To: <874kuhl18k.fsf@gmail.com> (message from Noam Postavsky on Sat, 21 Mar 2020 19:47:07 -0400) 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177622 Archived-At: > From: Noam Postavsky > Cc: michael_heerdegen@web.de, joostkremers@fastmail.fm, > 40088@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Sat, 21 Mar 2020 19:47:07 -0400 > > The underlying cause is in backtrace_eval_unrewind, which is used to > temporarily reverse let-bindings (it's called with a positive argument > to reverse bindings, and then a negative argument to re-apply them) by > backtrace--locals and backtrace-eval. For the SPECPDL_LET_DEFAULT and > SPECPDL_LET_LOCAL cases (which occur for let-bindings on buffer-local > variables), the code calls Fdefault_value and Fbuffer_local_value on the > symbol. > > For symbols which are unbound at top-level, the first (with positive > argument) call to backtrace_eval_unrewind will set the symbol's value to > unbound (putting the current value in the specpdl's "old value" slot). > On the second (with negative argument) call, backtrace_eval_unrewind > attempts to retrieve the symbol's value with Fdefault_value or > Fbuffer_local_value, but that raises a void-variable signal. This > interrupts the restoration of the let-bindings, so any other variables > more recent on the stack will now have the wrong value. > > ielm happens to have some buffer-local variables which are unbound at > top-level, which is why it can trigger this problem. But any situation > with void variables with buffer-local let-bindings can also trigger it. > > Now, all of the above is true also for Emacs 26 and earlier. It sounds like a very basic error. How come we never saw it before? Is it just luck? > So the effects of this bug are newly significant in Emacs 27. The fact > that it strikes when the debugger opens, means that it can multiply the > difficulty of analysing other bugs. And the fix looks quite small and > safe enough to qualify for emacs-27. I'm okay with making the change on the emacs-27 branch, but please put some of the description above in the commit log message, including why calling default_value etc. avoids the problem (which might not be obvious, unless one remembers by heart what Fdefault_value does). Thanks.