all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Joost Kremers <joostkremers@fastmail.fm>,
	40088@debbugs.gnu.org
Subject: bug#40088: 27.0.90; Symbol’s value as variable is void: debugger-outer-match-data
Date: Fri, 20 Mar 2020 04:37:49 -0400	[thread overview]
Message-ID: <87d097l8v6.fsf@gmail.com> (raw)
In-Reply-To: <jwvblotmc8k.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 18 Mar 2020 20:18:50 -0400")

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

tags 40088 + patch
quit

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Since the void-variable is getting triggered from
>> backtrace_eval_unrewind, I tried the patch below, which almost seems
>> to fix the problem,
>
> Indeed, the patch looks good (except for the removal of `static` which
> seems like a spurious artifact).

No, the removal is on purpose, because I'm calling default_value from
eval.c, and it's defined in data.c.  But, maybe you thought that because
I didn't add the corresponding declaration in a header file, and...

>> but after continuing from the debugger there's a
>> segfault in GC, so it's definitely not the Right Thing.

... the segfault happens because I forgot to declare default_value in
lisp.h, so its return value got converted to int.  *Forehead slap*

So here's the proper patch.  Eli, is it okay for emacs-27?  As I
mentioned earlier, the underlying bug was present in Emacs 26 and
earlier, but it's only surfaced in Emacs 27 because of debug.el
enhancements.


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2139 bytes --]

From 9afae526cf1959f5922dffb9254578dfe12ee4be Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Fri, 20 Mar 2020 04:07:39 -0400
Subject: [PATCH] Don't signal during backtrace unrewind (Bug#40088)

* src/data.c (default_value): Make non-static.
* src/lisp.h: Declare it.
* src/eval.c (backtrace_eval_unrewind): Call default_value and
buffer_local_value instead of Fdefault_value and Fbuffer_local_value,
respectively, so that unrewinding to unbound variables will not signal
an error.
---
 src/data.c | 2 +-
 src/eval.c | 4 ++--
 src/lisp.h | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/data.c b/src/data.c
index b153068846..5ce5e360ab 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1573,7 +1573,7 @@ notify_variable_watchers (Lisp_Object symbol,
 /* Return the default value of SYMBOL, but don't check for voidness.
    Return Qunbound if it is void.  */
 
-static Lisp_Object
+Lisp_Object
 default_value (Lisp_Object symbol)
 {
   struct Lisp_Symbol *sym;
diff --git a/src/eval.c b/src/eval.c
index 4559a0e1f6..78a787c4ff 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3816,7 +3816,7 @@ backtrace_eval_unrewind (int distance)
 	  {
 	    Lisp_Object sym = specpdl_symbol (tmp);
 	    Lisp_Object old_value = specpdl_old_value (tmp);
-	    set_specpdl_old_value (tmp, Fdefault_value (sym));
+	    set_specpdl_old_value (tmp, default_value (sym));
 	    Fset_default (sym, old_value);
 	  }
 	  break;
@@ -3832,7 +3832,7 @@ backtrace_eval_unrewind (int distance)
 	    if (!NILP (Flocal_variable_p (symbol, where)))
 	      {
 		set_specpdl_old_value
-		  (tmp, Fbuffer_local_value (symbol, where));
+		  (tmp, buffer_local_value (symbol, where));
                 set_internal (symbol, old_value, where, SET_INTERNAL_UNBIND);
 	      }
 	  }
diff --git a/src/lisp.h b/src/lisp.h
index 8674fe11a6..92294ac1d3 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -594,6 +594,7 @@ #define ENUM_BF(TYPE) enum TYPE
 
 /* Defined in data.c.  */
 extern AVOID wrong_type_argument (Lisp_Object, Lisp_Object);
+extern Lisp_Object default_value (Lisp_Object symbol);
 
 
 /* Defined in emacs.c.  */
-- 
2.11.0


  reply	other threads:[~2020-03-20  8:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16 11:40 bug#40088: 27.0.90; Symbol’s value as variable is void: debugger-outer-match-data Joost Kremers
2020-03-17  1:01 ` Michael Heerdegen
2020-03-17 10:41   ` Robert Pluim
2020-03-17 11:06   ` Dmitry Gutov
2020-03-18  0:06     ` Michael Heerdegen
2020-03-18  0:12       ` bug#40088: 27.0.90; Symbol?s " Drew Adams
2020-03-18  1:44         ` Noam Postavsky
2020-03-18  1:49           ` Drew Adams
2020-03-18 22:31           ` Michael Heerdegen
2020-03-18  6:34       ` bug#40088: 27.0.90; Symbol’s " Dmitry Gutov
2020-03-18 22:24         ` Michael Heerdegen
2020-03-18 22:30           ` Dmitry Gutov
2020-03-18 22:46             ` Michael Heerdegen
2020-03-17 11:44   ` Noam Postavsky
2020-03-19  0:04     ` Noam Postavsky
2020-03-19  0:18       ` Stefan Monnier
2020-03-20  8:37         ` Noam Postavsky [this message]
2020-03-20  8:56           ` Eli Zaretskii
2020-03-21 23:47             ` Noam Postavsky
2020-03-22 14:25               ` Eli Zaretskii
2020-03-23  3:17                 ` Noam Postavsky
2020-03-23  3:30                   ` Eli Zaretskii
2020-03-23  3:40                     ` Noam Postavsky
2020-03-23 14:16                       ` Eli Zaretskii
2020-03-23 14:34                         ` Noam Postavsky
2020-03-23 15:53                 ` Joost Kremers
2020-03-20 13:20           ` Stefan Monnier
2020-03-20 14:00             ` Robert Pluim
2020-03-20 14:51               ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d097l8v6.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=40088@debbugs.gnu.org \
    --cc=joostkremers@fastmail.fm \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.