From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Noam Postavsky 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: Sat, 21 Mar 2020 19:47:07 -0400 Message-ID: <874kuhl18k.fsf@gmail.com> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="14265"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux) Cc: michael_heerdegen@web.de, joostkremers@fastmail.fm, 40088@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 22 00:48:12 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 1jFnqe-0003as-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 00:48:12 +0100 Original-Received: from localhost ([::1]:41926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFnqc-0005SL-QE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Mar 2020 19:48:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38979) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFnqV-0005SF-UT for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:48:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFnqU-0008Gu-ME for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:48:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFnqU-0008Gf-BG for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFnqU-00071O-9X for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Mar 2020 23:48: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.158483443726926 (code B ref 40088); Sat, 21 Mar 2020 23:48:02 +0000 Original-Received: (at 40088) by debbugs.gnu.org; 21 Mar 2020 23:47:17 +0000 Original-Received: from localhost ([127.0.0.1]:48453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFnpl-00070E-0i for submit@debbugs.gnu.org; Sat, 21 Mar 2020 19:47:17 -0400 Original-Received: from mail-qv1-f49.google.com ([209.85.219.49]:34432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFnpj-0006zy-2M for 40088@debbugs.gnu.org; Sat, 21 Mar 2020 19:47:15 -0400 Original-Received: by mail-qv1-f49.google.com with SMTP id o18so5238624qvf.1 for <40088@debbugs.gnu.org>; Sat, 21 Mar 2020 16:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Xp+zs5h+qn1x62yjTpn/T6lAhN9uwvXTdYEvYsm5z64=; b=ki5d8bBlpVEKRGMjXkF3B0FuVqn4FW4SUWFre3rO2rE5RoQgB8sA9Nzikg+GUL4idQ V/mJY9vDnVyl75g+ezkP7jU+Qi9OpAosDwwOHbyo+qcpfG1xlBS5ExjxUkYJgn0SLqa4 gM/sFQgoXxyzhPkVYfUAE9Gqc2uiG7ujDxva+WDLP/uvvPeY8VBZZi2W0gstO32vjrCO qbfhtA0G3KRw0HMzNdL7+9QfKpRvhzMbj3zsqDCvxsP3Zg9Ubyb56UH/JkOqIhdet1nJ W2Vi+YXxa9Y2bnIvMqsWpbNkmPJXUZSwNn2woRz8LLmuuRIi+OWnJ+ZjWd3KqHvEej7T bjkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Xp+zs5h+qn1x62yjTpn/T6lAhN9uwvXTdYEvYsm5z64=; b=AkFNnXeLJN0GlE8/Y72o9qsCVxvlcMwgR7ScUC9qIlssX7ML2UfRNxluL/jUO6fMRn c2NUsZ8mikWBg6IHkQgU1/frXCO2NeGC8A51Ov9Te/L9wDzFGujObQL9HufGDqPObw4c Zkzj9NPBoixmg7SoMJldA9/88g5unDGQHKAQ7nc+Euriqm2bSKy8t1c0GZAaJuMzxjbW GPDmf5Wa8EgssOR1nMLl379ywOnOo2c9IjFX88TaFgmYRM19ExbGj7Y6mEso88QoAzQe zn7GOA9hoUbL4tQlyUZik1CAiyA1tCLE/gw8hgn4mg8OsSH2gnq+FY4ToYoyyTU+Ggkd 5hBA== X-Gm-Message-State: ANhLgQ1FmMjn4nKeIgvARc8z8aCEt3rWXHEoMy7i5riPDI7/yuXbwfgF zQi8pntRz6UxpsQqSFdP5wU= X-Google-Smtp-Source: ADFU+vtT71J9ayrnZv1hlj0nGdF3/Dxs07fSYAHLvsW3Q7VmjZm9zwtazW5WqeGkEnncjRJtgRzvVQ== X-Received: by 2002:a0c:f909:: with SMTP id v9mr8067614qvn.159.1584834429469; Sat, 21 Mar 2020 16:47:09 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-47.yyz.frontiernetworks.ca. [45.2.119.47]) by smtp.gmail.com with ESMTPSA id g201sm1440387qke.99.2020.03.21.16.47.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Mar 2020 16:47:08 -0700 (PDT) In-Reply-To: <83r1xne753.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 20 Mar 2020 10:56:56 +0200") 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:177610 Archived-At: Eli Zaretskii writes: > I don't think I understand what problem are you trying to solve, let > alone why it's important to solve it in Emacs 27. At least the > original issue doesn't sound important to me, but maybe I'm missing > something. > I also don't think I understand what is your analysis of the issue; > perhaps the commit log message could include more detailed > explanation. Yes, sorry, my analysis previously wasn't really more than 'raising a signal while messing with the pdl stack seems bad'. I've debugged a bit more to see what's happening. 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. The main difference in Emacs 27 is that debug.el calls backtrace--locals up front, during setup. In Emacs 26, it's only called when calling backtrace-toggle-locals. This means there would be hardly other variables on the stack to get wrong value. Also, errors in v26 ielm evaluation don't raise the debugger (because ielm-eval-input used conditiion-case rather than condition-case-unless-debug). 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.