From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#66912: With `require', the byte compiler reports the wrong file for errors. Date: Thu, 7 Nov 2024 12:37:56 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36216"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , 66912@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 07 13:39:23 2024 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 1t91nH-0009D8-50 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Nov 2024 13:39:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t91my-0000pC-Kg; Thu, 07 Nov 2024 07:39:04 -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 1t91mw-0000p2-Ie for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 07:39:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t91mw-0001x3-6G for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 07:39:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:In-Reply-To:MIME-Version:References:Date:To:Subject; bh=+aIavXo/79qwu9n8WqSuDf7lUuF7qJIOVwI1QdpGqd0=; b=vCFyKaqdjAcviHy/3Fb5hw5aDxftTBrZ0fo9UbAvNhTBmifBtes2+MfqLPxleHWQSZ+run0b/nLtR8quBGk0iIo76Rju4LUg+TIRPFOb6hczDHso5olmDqP6ROoEp4DTjeuYkM1fHT8DyP3L1xuVq73vKIbG+h03epnWlPk+a099aQsNQcFVduKxK8UF+a46XPmLymFDsP3cu/6ghDbDGP/0MycLQuw2t1hED7RaZk+bt4qc21EOCeaa4aDzCjVVQDnPGyZ5e9T2PNHwW4Yyhrt6gaJbYIXlyNGzMTk+BMXEpKbwdfg01PK1aqguIJW6aV6d6ph7+mSxH+UsAIKGlw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t91mv-0005SE-Lw for bug-gnu-emacs@gnu.org; Thu, 07 Nov 2024 07:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Nov 2024 12:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66912 X-GNU-PR-Package: emacs Original-Received: via spool by 66912-submit@debbugs.gnu.org id=B66912.173098308920901 (code B ref 66912); Thu, 07 Nov 2024 12:39:01 +0000 Original-Received: (at 66912) by debbugs.gnu.org; 7 Nov 2024 12:38:09 +0000 Original-Received: from localhost ([127.0.0.1]:47495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t91m4-0005R2-97 for submit@debbugs.gnu.org; Thu, 07 Nov 2024 07:38:08 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:49374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t91m0-0005QV-R1 for 66912@debbugs.gnu.org; Thu, 07 Nov 2024 07:38:07 -0500 Original-Received: (qmail 5493 invoked by uid 3782); 7 Nov 2024 13:37:57 +0100 Original-Received: from muc.de (p4fe15e61.dip0.t-ipconnect.de [79.225.94.97]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 07 Nov 2024 13:37:57 +0100 Original-Received: (qmail 5864 invoked by uid 1000); 7 Nov 2024 12:37:57 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295019 Archived-At: Hello, Stefan. On Wed, Nov 06, 2024 at 18:14:18 -0500, Stefan Monnier wrote: > >> (while (not (equal Vloads_in_progress_of_last_error Vloads_in_progress)) > >> (setq msg (concat msg " while loading " > >> (pop Vloads_in_progress_of_last_error)))) > > This doesn't make sense in the current implementation (sorry for not > > sending you a patch), because Vloads_in_progress_at_error is copied from > > Vloads_in_progress in signal_or_quit. > I don't understand why you say it doesn't make sense: > An error in signaled from with a => B, so in `signal_or_quit` you copy > `Vloads_in_progress` which contains `("B" "A")` to > `Vloads_in_progress_at_error` and then you throw the error at the > condition-case which was installed (say) from within the file A so > when you reach the handler, `Vloads_in_progress` will have been reset to > `("A")` so the above loop will correctly say that the error occurred > from within B. OK, I see what you mean. But if the error gets handled in a handler-bind handler, or goes through to the debugger without being intercepted by a condition-case, the binding stack will not have been unwound. In that case the difference between the two lists would be empty. > >> > I've tried it, and the above problem seems definitely to make it less > >> > simple than the approach I originally took (which currently works). > >> AFAIK, your previous approach suffered from the exact same problem, tho > >> maybe in fewer cases. > > No, it doesn't. There, Vloads_still_in_progress is kept in synch with > > Vloads_in_progress when Fload operations start and end. When the > > debugger or error handler outputs a message using Vl_still_i_p, it > > resets that variable to nil, preventing it getting output again. > You may be right that the "fewer" case are so few so that there really > aren't any. I'm not convinced there cannot be a code path that happens > not to pass via those settings to nil, but maybe you're right. > Still, my A => B => compile => C => D examples still stands, which is > still at heart the same problem IMO, and could be worked around with my > `while` loop above. One way to fix this would be to make Vloads_still_in_progress visible to Lisp, and to bind it to nil in the byte compiler. But that might get a bit complicated. > > At the moment, I think my currently working solution is the best way > > to go. > [ As you can guess, I disagree, mostly because I think the problems of > my suggested approach are "familiar", since the behavior can be > compared to things like the match-data, so we know how to live with > its shortcomings, whereas I can't think of something else we already > have which follows an approach like yours, .... Something very similar, if not the same, was the original handling of byte-compile-form-stack. There a form was pushed onto the stack at the start of a byte-compile- function, and popped off again at its end, without using binding. In the case of an error, where the binding stack gets unwound, byte-compile-form-stack retained its value at the time of the error. It worked without trouble (as far as I'm aware). > .... so we're in new territory and it's harder to see what the > problems could be and what workarounds to use. ] > Then you'd be better get cracking at the documentation of "survives > unbinding" 🙂 I will do that. > Stefan -- Alan Mackenzie (Nuremberg, Germany).