From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#40766: 27.0.91; Cannot edebug cl-lambda-list edebug spec Date: Thu, 23 Apr 2020 19:23:54 +0000 Message-ID: <20200423192354.GA6462@ACM> References: <20200423064128.95594.qmail@mail.muc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="15825"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40766@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 23 21:24:17 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 1jRhSJ-0003xy-Am for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Apr 2020 21:24:15 +0200 Original-Received: from localhost ([::1]:38082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRhSI-0008Hz-Ce for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Apr 2020 15:24:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41794) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRhS7-0008Ho-3h for bug-gnu-emacs@gnu.org; Thu, 23 Apr 2020 15:24:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRhS6-0007T5-8k for bug-gnu-emacs@gnu.org; Thu, 23 Apr 2020 15:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRhS5-0007T0-T3 for bug-gnu-emacs@gnu.org; Thu, 23 Apr 2020 15:24:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jRhS5-0006Te-Pf for bug-gnu-emacs@gnu.org; Thu, 23 Apr 2020 15:24:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Apr 2020 19:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40766 X-GNU-PR-Package: emacs Original-Received: via spool by 40766-submit@debbugs.gnu.org id=B40766.158766983924890 (code B ref 40766); Thu, 23 Apr 2020 19:24:01 +0000 Original-Received: (at 40766) by debbugs.gnu.org; 23 Apr 2020 19:23:59 +0000 Original-Received: from localhost ([127.0.0.1]:55854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRhS3-0006TO-DV for submit@debbugs.gnu.org; Thu, 23 Apr 2020 15:23:59 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:48662 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jRhS1-0006TD-Kp for 40766@debbugs.gnu.org; Thu, 23 Apr 2020 15:23:58 -0400 Original-Received: (qmail 67119 invoked by uid 3782); 23 Apr 2020 19:23:55 -0000 Original-Received: from acm.muc.de (p4FE15C02.dip0.t-ipconnect.de [79.225.92.2]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Thu, 23 Apr 2020 21:23:54 +0200 Original-Received: (qmail 6570 invoked by uid 1000); 23 Apr 2020 19:23:54 -0000 Content-Disposition: inline In-Reply-To: <20200423064128.95594.qmail@mail.muc.de> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:178867 Archived-At: Hello again, Philipp. On Thu, Apr 23, 2020 at 06:41:28 -0000, Alan Mackenzie wrote: > In article you wrote: > > emacs -Q > > M-x find-library RET cl-macs RET > > Navigate to the form `(def-edebug-spec cl-lambda-list ...)' > > Hit C-u C-M-x to edebug it. > > This results in an error with backtrace: Yes. There is a bug in the edebug specs for edebug-spec-list and edebug-spec. (Sorry about this sounding confusing. Believe me, it's nothing compared with the head banging involved in keeping various levels of the debug specs mentally separate. ;-) These two specs are the main components of the debug spec for def-edebug-spec. (It's probably still confusing at this stage.) These two things look like this: (def-edebug-spec edebug-spec-list ;; A list must have something in it, or it is nil, a symbolp ((edebug-spec . [&or nil edebug-spec]))) (def-edebug-spec edebug-spec (&or ; edebug-spec-list <============================================== (vector &rest edebug-spec) ; matches a vector ("vector" &rest edebug-spec) ; matches a vector spec ("quote" symbolp) edebug-spec-list ;; <============================================ stringp [edebug-lambda-list-keywordp &rest edebug-spec] [keywordp gate edebug-spec] edebug-spec-p ;; Including all the special ones e.g. form. symbolp;; a predicate )) The target spec, let's continue calling it spec 2, reduced to it's minimum required to trigger the bug, looks like: (def-edebug-spec acm-lambda-list (([&rest cl-lambda-arg] ["&optional" cl-&optional-arg &rest cl-&optional-arg] . [&or arg nil]))) . The essential attributes are it has enclosing parens (at least) containing two vectors followed by a dot followed by a third vector. When spec 2 gets parsed by edebug-spec (see above), it eventually reaches a dotted list containing the three vectors. It parses this with edebug-spec-list containing the first two vectors. But BECAUSE edebug-spec-list IS MISPLACED INSIDE edebug-spec (see the two arrowed lines), the second vector triggers recognition by (vector ....) rather than by edebug-spec-list. This "dedottifies" the dotted list in spec 2, so that when the dot in spec 2 is reached, edebug-spec-list doesn't know how to handle it. For some reason, the backtracking doesn't backtrack here. The solution to the problem is to move the edebug-spec-list from after the (vector ...) and ("quote" ....) entries to before them, as indicated above. This causes the second vector to get handled as the first element of the cdr of the list it's contained within. > Yes, I get this too. The debug-spec definition looks like this: > (def-edebug-spec cl-lambda-list > (([&rest cl-lambda-arg] > [&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]] > [&optional ["&rest" cl-lambda-arg]] > [&optional ["&key" [cl-&key-arg &rest cl-&key-arg] > &optional "&allow-other-keys"]] > [&optional ["&aux" &rest > &or (symbolp &optional def-form) symbolp]] > . [&or arg nil]))) > After playing around with it for a few hours, it is clear that the > bug is triggered by a combination of (i) the dot on the last line; and > (ii) the presence of at least one [&optional ...] before it, at the same > level of nesting. Possibly the nesting of [ ... ] structures might have > something to do with it. So, I propose installing the following patch to fix the bug: diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index bb7817f242..7995a9e5a2 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -2115,10 +2115,10 @@ edebug-spec-list (def-edebug-spec edebug-spec (&or + edebug-spec-list (vector &rest edebug-spec) ; matches a vector ("vector" &rest edebug-spec) ; matches a vector spec ("quote" symbolp) - edebug-spec-list stringp [edebug-lambda-list-keywordp &rest edebug-spec] [keywordp gate edebug-spec] > > -- > > Google Germany GmbH > > Erika-Mann-Straße 33 > > 80636 München -- Alan Mackenzie (Nuremberg, Germany).