From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#54079: 29.0.50; Method dispatching eratically fails Date: Sat, 05 Mar 2022 12:57:09 -0500 Message-ID: References: <87bkz113hz.fsf@web.de> <87mtik3l54.fsf@web.de> <87ilt6bgnt.fsf@web.de> <87sfsapgv0.fsf@web.de> <87o82ypfxz.fsf@web.de> <875youbhbu.fsf@web.de> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23193"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Michael Heerdegen , Lars Ingebrigtsen , 54079@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 05 18:58:11 2022 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 1nQYfT-0005hR-06 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Mar 2022 18:58:11 +0100 Original-Received: from localhost ([::1]:55362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQYfR-0006e7-Dy for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 05 Mar 2022 12:58:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQYfK-0006do-DJ for bug-gnu-emacs@gnu.org; Sat, 05 Mar 2022 12:58:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nQYfK-0000l2-4f for bug-gnu-emacs@gnu.org; Sat, 05 Mar 2022 12:58:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nQYfK-0004Fp-3u for bug-gnu-emacs@gnu.org; Sat, 05 Mar 2022 12:58:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Mar 2022 17:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54079 X-GNU-PR-Package: emacs Original-Received: via spool by 54079-submit@debbugs.gnu.org id=B54079.164650304516309 (code B ref 54079); Sat, 05 Mar 2022 17:58:02 +0000 Original-Received: (at 54079) by debbugs.gnu.org; 5 Mar 2022 17:57:25 +0000 Original-Received: from localhost ([127.0.0.1]:49018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQYej-0004Ey-9q for submit@debbugs.gnu.org; Sat, 05 Mar 2022 12:57:25 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25959) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nQYeh-0004Ek-TK for 54079@debbugs.gnu.org; Sat, 05 Mar 2022 12:57:24 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8D4FD8067F; Sat, 5 Mar 2022 12:57:17 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2CC8380298; Sat, 5 Mar 2022 12:57:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1646503036; bh=3VTL1G5+79eAhQrfZG+ktwxKM3J99Uk9P/xN4Q1wJVc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=bj6q6C26xFPtAFvHa88Sad7t0Iu1cOTGSwiL2FXgqhfUR/3H7IDzTnkZ79qJZ9cBy av0ae5Fk3nu+QtXdCkSwNLEZtimviUkUlQ7JqnP3us5eNMNgvVamnfvcNfS47XKk8J KF5evmlH54u7CoqYGlXC59U9fiMuzjjSN1cuuRMLAlq72CruDlUvhy/lkwRM50O+HZ TiX3mGzOzByoy1FP35n4zh2+pW3W0rWPtc2ZoiXDaVWAaTd6F/oLdtkDqPbpSbgoR+ 6v+6Qq+oIcO5eAZp1cDy4OvHUyUPF5KI5faWhfhVoZ4GqmynRBnvfjDshxLXbHSFmS OWBdLE7s2yqeQ== Original-Received: from pastel (unknown [45.72.208.76]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CD3DE1201F4; Sat, 5 Mar 2022 12:57:15 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Sat, 5 Mar 2022 16:37:16 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:228032 Archived-At: > I think this problem can only happen for defuns/defvars/defconts inside > eval-when-compile or eval-and-compile. > Would you try out the following patch, please, which I believe fixes the > bug. Any chance we could fix it in `bytecomp.el` by calling `byte_run_strip_symbol_positions` before evaluating the contents of those forms? Maybe we should have a function to check for the absence of sympos which we could call (when in debugging mode only) from defvar/defalias and friends, which could give us useful backtraces showing where/when the sympos "leak"? Stefan > diff --git a/src/data.c b/src/data.c > index 1526cc0c73..0854b4efb4 100644 > --- a/src/data.c > +++ b/src/data.c > @@ -942,6 +942,13 @@ The return value is undefined. */) > (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) > { > CHECK_SYMBOL (symbol); > + /* If we're in a byte compilation, ensure the definition's symbols > + are stripped of their positions. */ > + if (symbols_with_pos_enabled > + && SYMBOL_WITH_POS_P (symbol) > + && Ffboundp (Qbyte_run_strip_symbol_positions)) > + call1 (Qbyte_run_strip_symbol_positions, definition); > + > if (!NILP (Vpurify_flag) > /* If `definition' is a keymap, immutable (and copying) is wrong. */ > && !KEYMAPP (definition)) > @@ -4352,6 +4359,8 @@ This variable cannot be set; trying to do so will signal an error. */); > Bind this to non-nil in applications such as the byte compiler. */); > symbols_with_pos_enabled = false; > > + DEFSYM (Qbyte_run_strip_symbol_positions, "byte-run-strip-symbol-positions"); > + > DEFSYM (Qwatchers, "watchers"); > DEFSYM (Qmakunbound, "makunbound"); > DEFSYM (Qunlet, "unlet"); > diff --git a/src/eval.c b/src/eval.c > index 294d79e67a..1b1fde3a20 100644 > --- a/src/eval.c > +++ b/src/eval.c > @@ -794,6 +794,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) > if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) > error ("Too many arguments"); > Lisp_Object exp = XCAR (tail); > + /* If we're in a byte compilation, ensure the definition's > + symbols are stripped of their positions. */ > + if (symbols_with_pos_enabled > + && SYMBOL_WITH_POS_P (sym) > + && Ffboundp (Qbyte_run_strip_symbol_positions)) > + call1 (Qbyte_run_strip_symbol_positions, exp); > > tem = Fdefault_boundp (sym); > tail = XCDR (tail); > @@ -861,6 +867,14 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) > } > > Finternal__define_uninitialized_variable (sym, docstring); > + > + /* If we're in a byte compilation, ensure the definition's symbols > + are stripped of their positions. */ > + if (symbols_with_pos_enabled > + && SYMBOL_WITH_POS_P (sym) > + && Ffboundp (Qbyte_run_strip_symbol_positions)) > + call1 (Qbyte_run_strip_symbol_positions, XCAR (XCDR (args))); > + > tem = eval_sub (XCAR (XCDR (args))); > if (!NILP (Vpurify_flag)) > tem = Fpurecopy (tem); > > >> Michael.