From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#28280: Maximally unhelpful diagnostic message. Date: Wed, 30 Aug 2017 08:17:24 -0400 Message-ID: <874lsp8d2j.fsf@users.sourceforge.net> References: <20170829184140.GA4339@ACM> <20170829201557.GB4339@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1504095442 7357 195.159.176.226 (30 Aug 2017 12:17:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 12:17:22 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 28280@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 30 14:17:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dn1vk-0001N8-2s for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Aug 2017 14:17:12 +0200 Original-Received: from localhost ([::1]:50264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn1vp-0005Uo-5s for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Aug 2017 08:17:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dn1uf-0004y6-Sh for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 08:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dn1uc-0007nD-Nj for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 08:16:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52995) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dn1uc-0007n7-Jh for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 08:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dn1uc-0004vh-EE for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 08:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Aug 2017 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28280 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28280-submit@debbugs.gnu.org id=B28280.150409535818935 (code B ref 28280); Wed, 30 Aug 2017 12:16:02 +0000 Original-Received: (at 28280) by debbugs.gnu.org; 30 Aug 2017 12:15:58 +0000 Original-Received: from localhost ([127.0.0.1]:33443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dn1uW-0004vJ-V2 for submit@debbugs.gnu.org; Wed, 30 Aug 2017 08:15:58 -0400 Original-Received: from mail-io0-f195.google.com ([209.85.223.195]:35954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dn1uV-0004v7-OD for 28280@debbugs.gnu.org; Wed, 30 Aug 2017 08:15:56 -0400 Original-Received: by mail-io0-f195.google.com with SMTP id 2so860450ion.3 for <28280@debbugs.gnu.org>; Wed, 30 Aug 2017 05:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=poCL5g3j0J2wHtRbkICeyO9jQ/HzNAShK0A5WGw7SlQ=; b=U5OJsF96AcHGF5dcHiU28V0yo2EKP2wftkFFp4aQ3z0PYqWdYOrJTKYZHOYx0SqW9T 8qt5ePFdF8sfQVsRVXj6qhsXoREz+5eebn/z56GAmpCGCKsXKPEyvfNrhAmK51++YoV+ fnVefiCQ2+4A+jei56zuAgbmvSKOnPYgTqz+h3sj+pWDBXIgelwJSBtVv+nHUBA8UR32 jLkjHEwQ7X5PhVsPGEGPUyV8sqsevOfc7dqaK5lzblAJswVSO8kJ73sy+Be4PoMvmZ7M YPCQgF7ilhAXVRnWIIa8UFuvSOn0OHoCtJV7TIMXfm/NAmpoXGy7nvAVX+ZstL9tYA5h kATA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=poCL5g3j0J2wHtRbkICeyO9jQ/HzNAShK0A5WGw7SlQ=; b=JLvmDIk8d52uEkMdKL3TcBLumFYVSffpwIcBf5NzjHZFdJgTuQGTk5j5olYwOoO6EZ OFUCbq9w4v3v+MQxxvfaewNsVlOsmhDD7k6cNpNcct2DSG4nzTME3i/3U3/U9CdSLaup sPE8FSgkIu+88OPhd9ql7/flp3Kdma4HlhQ3lHlwz9rHy3ScKggRYq35p+KuEUlUrKET aZtK9gnn2ZcehBtX4uIBjH4xm1HFHDHspJJWazq2y9uavYS9cBGPICTCTiAGVGfPcxsl z9BHDNn20ol1Uilw3G7PVQp8wLAR1Bt3wIU2FA6OaIOsVuQ/Kk+qNoaUKxlg+YFlKoXS BL2w== X-Gm-Message-State: AHPjjUg6OiMk8UwfR4muUIyEqGgMWriCDNlBQrG7LOEayn13T+5dIf+z 46/XnXV960JnpVJv X-Received: by 10.107.26.76 with SMTP id a73mr1109078ioa.229.1504095348987; Wed, 30 Aug 2017 05:15:48 -0700 (PDT) Original-Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id v142sm2162380ita.35.2017.08.30.05.15.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 05:15:46 -0700 (PDT) In-Reply-To: <20170829201557.GB4339@ACM> (Alan Mackenzie's message of "Tue, 29 Aug 2017 20:15:57 +0000") 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: 208.118.235.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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136375 Archived-At: --=-=-= Content-Type: text/plain Alan Mackenzie writes: > Yes, but that's a separate problem from the essence of the bug report. > Regardless of the lack of progress on bug #18913, the information > provided by an assert being triggered is unhelpful and inadequate. Here is a possible M-x cl-show-assert command: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-New-command-to-backtrace-from-assertion-failure-B.patch Content-Description: patch >From 835486ccfaaf58476cbb0e097bed3b81adbcfebe Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 30 Aug 2017 08:12:18 -0400 Subject: [PATCH v1] New command to backtrace from assertion failure (Bug#28280) * lisp/emacs-lisp/cl-lib.el (cl-show-assert): New command. (cl-assert-last-backtrace): New variable. * lisp/emacs-lisp/cl-preloaded.el (cl--assertion-failed): Set it. TODO: keybinding? NEWS. --- lisp/emacs-lisp/cl-lib.el | 15 +++++++++++++++ lisp/emacs-lisp/cl-preloaded.el | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 243622a301..59bbdbca51 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -614,6 +614,21 @@ cl-pairlis ;;; Miscellaneous. +(defvar cl-assert-last-backtrace nil + "Holds a list of frames from the last assertion failure.") + +(declare-function debugger-insert-backtrace "debug" (backtrace doxrefs)) + +(defun cl-show-assert () + "Show backtrace from last assertion failure." + (interactive) + (unless cl-assert-last-backtrace + (user-error "There hasn't been an assertion failure yet")) + (require 'debug) + (with-current-buffer (get-buffer-create "*Assertion Failure*") + (debugger-insert-backtrace cl-assert-last-backtrace t) + (display-buffer (current-buffer)))) + (provide 'cl-lib) (unless (load "cl-loaddefs" 'noerror 'quiet) ;; When bootstrapping, cl-loaddefs hasn't been built yet! diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index ab6354de7c..d66a4b9726 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -41,13 +41,19 @@ ;; The `assert' macro from the cl package signals ;; `cl-assertion-failed' at runtime so always define it. -(define-error 'cl-assertion-failed (purecopy "Assertion failed")) +(define-error 'cl-assertion-failed (purecopy "Assertion failed (\\[cl-show-assert] for backtrace)")) + +(defvar cl-assert-last-backtrace) (defun cl--assertion-failed (form &optional string sargs args) (if debug-on-error (funcall debugger 'error `(cl-assertion-failed (,form ,string ,@sargs))) + (setq cl-assert-last-backtrace (backtrace-frames 'cl--assertion-failed)) + (autoload 'cl-show-assert "cl-lib" + "Show backtrace from last assertion failure." t) (if string - (apply #'error string (append sargs args)) + (apply #'error (concat string " (\\[cl-show-assert] for backtrace)") + (append sargs args)) (signal 'cl-assertion-failed `(,form ,@sargs))))) ;; When we load this (compiled) file during pre-loading, the cl--struct-class -- 2.14.1 --=-=-= Content-Type: text/plain > That aside, I can't see how the two assertions suggested in #18913 could > trigger the message I saw. I'll maybe have a look at the actual patch > sometime when I'm less tired. There is a third assertion added in [1: 62ee8b1a59] which is the one you hit. [1: 62ee8b1a59]: 2014-10-31 16:57:59 -0400 * lisp/simple.el (newline): Add assertions to try and help catch bug#18913. http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=62ee8b1a59d5343197cb59d9f0a52e07a23af1d8 --=-=-=--