GNU bug report logs - #11218
with-demoted-errors use of condition-case-unless-debug; ert

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Glenn Morris <rgm@HIDDEN>; dated Wed, 11 Apr 2012 03:39:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 21 May 2012 03:03:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 20 23:03:53 2012
Received: from localhost ([127.0.0.1]:35998 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SWIuW-0007LY-Vc
	for submit <at> debbugs.gnu.org; Sun, 20 May 2012 23:03:53 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:53276 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ohler@HIDDEN>) id 1SWIuU-0007LR-TK
	for 11218 <at> debbugs.gnu.org; Sun, 20 May 2012 23:03:51 -0400
Received: from [204.14.153.109] (port=44607 helo=kamel.local)
	by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <ohler@HIDDEN>)
	id 1SWItt-0005cV-Ob; Sun, 20 May 2012 23:03:13 -0400
Message-ID: <4FB9B071.1060907@HIDDEN>
Date: Sun, 20 May 2012 20:03:13 -0700
From: Christian Ohler <ohler@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN> <4F91CEEF.20305@HIDDEN>
	<jwvsjfxstne.fsf-monnier+emacs@HIDDEN> <4FA6C6B3.7010403@HIDDEN>
	<jwvbom0ztnx.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvbom0ztnx.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Stefan Monnier, 2012-05-06:

>> Collecting additional information about why the test failed is useful
>> to virtually everyone who bothers running the test; there should be no
>> reason not to.
>
> I disagree here.  I think it's just as well if the "check" and the
> "debug" are done in 2 different steps.

ERT originally worked like you describe, until I got tired of having to 
re-run each failed test just to get a backtrace.  The computer has the 
information in memory at the time the test fails; it should store it 
somewhere for me to look at later, rather than making me wait while it 
tries to recompute it.  The backtrace is so basic that I practically 
always want to see it.

In batch mode, ERT also has to collect the backtrace on every failure; 
the idea of re-running with debugging enabled makes no sense in that 
context (if enabling debugging to collect backtraces in batch mode was 
an optional flag to be set on a second run after noticing failures on 
the first run, why not set that flag the first time around?).  Also, a 
continuous build system is much more useful if errors come with more 
information since that increases the chances that the bug can be fixed 
without first building a specific version on a specific architecture to 
reproduce it.


>> The proper solution is to decouple the behaviors, perhaps by splitting
>> the variable, perhaps by some other means.
>
> No, the proper solution is to make with-demoted-error (when run with
> debug-on-error) continue execution (after hitting `c' in the debugger)
> as if debug-on-error were nil.

That sounds like a good idea; I would add that it should be possible to 
invoke this "restart" (in CL terms) programmatically.  (This does 
decouple the behaviors: it allows errors to be demoted regardless of the 
setting of `debug-on-error'.)

Christian.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 7 May 2012 01:14:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 06 21:14:16 2012
Received: from localhost ([127.0.0.1]:38972 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SRCWm-0008OG-Gy
	for submit <at> debbugs.gnu.org; Sun, 06 May 2012 21:14:16 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:42016)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SRCWl-0008O2-5L
	for 11218 <at> debbugs.gnu.org; Sun, 06 May 2012 21:14:15 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApYIACxOgk9FxLCA/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kLoduBbYyi2GEeQSkRYFdgwM
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="178657775"
Received: from 69-196-176-128.dsl.teksavvy.com (HELO pastel.home)
	([69.196.176.128])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	06 May 2012 21:12:10 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id B22685916D; Sun,  6 May 2012 21:12:10 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Christian Ohler <ohler@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvbom0ztnx.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN> <4F91CEEF.20305@HIDDEN>
	<jwvsjfxstne.fsf-monnier+emacs@HIDDEN> <4FA6C6B3.7010403@HIDDEN>
Date: Sun, 06 May 2012 21:12:10 -0400
In-Reply-To: <4FA6C6B3.7010403@HIDDEN> (Christian Ohler's message of "Sun, 06
	May 2012 11:45:07 -0700")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> Collecting additional information about why the test failed is useful
> to virtually everyone who bothers running the test; there should be no
> reason not to.

I disagree here.  I think it's just as well if the "check" and the
"debug" are done in 2 different steps.

> The proper solution is to decouple the behaviors, perhaps by splitting
> the variable, perhaps by some other means.

No, the proper solution is to make with-demoted-error (when run with
debug-on-error) continue execution (after hitting `c' in the debugger)
as if debug-on-error were nil.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 6 May 2012 18:47:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 06 14:47:16 2012
Received: from localhost ([127.0.0.1]:38810 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SR6UG-0007Ea-9t
	for submit <at> debbugs.gnu.org; Sun, 06 May 2012 14:47:16 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:35822 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ohler@HIDDEN>) id 1SR6UB-0007EP-CH
	for 11218 <at> debbugs.gnu.org; Sun, 06 May 2012 14:47:12 -0400
Received: from [72.14.225.65] (port=10675
	helo=dhcp-172-16-8-100.lon.corp.google.com)
	by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <ohler@HIDDEN>)
	id 1SR6SG-0004ZY-EQ; Sun, 06 May 2012 14:45:12 -0400
Message-ID: <4FA6C6B3.7010403@HIDDEN>
Date: Sun, 06 May 2012 11:45:07 -0700
From: Christian Ohler <ohler@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN> <4F91CEEF.20305@HIDDEN>
	<jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Stefan Monnier, 2012-04-20:

>>> I don't see the point of showing that info when running the tests.
>>> If the user wants that info, he should be able to easily say "run this
>>> test with debug-on-error" so he doesn't only get a backtrace but also
>>> gets put in the debugger where he can inspect the state.
>
>> ERT's keyboard shortcut for that is "d".  But it's not a good solution if:
>
>> * the test is nondeterministic (maybe due to subprocess interaction),
>> * the test takes a long time to run,
>> * you have multiple failing tests and want to quickly compare if they are
>> crashing in the same place,
>> * ERT is running in batch mode (e.g. make check).
>
>> It's better to collect as much data as reasonably possible when the error
>> first occurs.
>
> None of these arguments are really specific to ERT.  It just seems like
> you like to run with debug-on-error, which is fine (I do too).

ERT's default behavior is very different from using Emacs with 
debug-on-error enabled, so in terms of what the user sees, I don't think 
this analogy works very well.


> But don't impose it on all ERT users.

This is not a matter of user preference.  Collecting additional 
information about why the test failed is useful to virtually everyone 
who bothers running the test; there should be no reason not to.  (Even 
if the user doesn't care about the details, it will at least allow them 
to file a better bug report.)  The problem is that the implementation 
doesn't interact well with `with-demoted-errors'.  But that problem is 
not user- or situation-dependent, so it shouldn't be a setting.


>>> No: you'll be put in the debugger for the error "a" but if you hit `c'
>>> it will continue and re-enter the debugger for error "b".
>> My Emacs is a few months old, but that doesn't work for me.  Has it
>> changed recently?
> [...]
>> If `debug-on-error' is t, `with-demoted-errors' becomes essentially
>> equivalent to `progn', and (error "b") can ever be reached in
>
> You're right, sorry: brain malfunction.
> But that just means you first have to fix the bug that signals "a" before
> getting to the bug that signals "b".

If it were that simple, this would be the solution to the OP's problem 
as well: Just fix the errors that are being demoted.

It's a bad solution, though; the user shouldn't have to do this. 
Enabling the debugger should not change the behavior of the code being 
debugged.  It's a design flaw in `with-demoted-errors' that its behavior 
depends on the same variable that controls the debugger.  The proper 
solution is to decouple the behaviors, perhaps by splitting the 
variable, perhaps by some other means.

Christian.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 24 Apr 2012 02:05:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 23 22:05:40 2012
Received: from localhost ([127.0.0.1]:49653 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SMV8O-0003eC-2q
	for submit <at> debbugs.gnu.org; Mon, 23 Apr 2012 22:05:40 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:45088)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SMV8M-0003dy-3a
	for 11218 <at> debbugs.gnu.org; Mon, 23 Apr 2012 22:05:38 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApUIACxOgk/O+Jnc/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjEAs0EhQYDSSIHAW2MothhHkEpEWBXYMD
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="176389439"
Received: from 206-248-153-220.dsl.teksavvy.com (HELO pastel.home)
	([206.248.153.220])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	23 Apr 2012 22:04:47 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 9B63458EB0; Mon, 23 Apr 2012 22:04:47 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Lennart Borgman <lennart.borgman@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwv7gx5nawp.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN> <4F91CEEF.20305@HIDDEN>
	<jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
	<CANbX365dKdVdph9E33dORDgszcx0FsAzr1dez4-bn1_0onQ8YQ@HIDDEN>
Date: Mon, 23 Apr 2012 22:04:47 -0400
In-Reply-To: <CANbX365dKdVdph9E33dORDgszcx0FsAzr1dez4-bn1_0onQ8YQ@HIDDEN>
	(Lennart Borgman's message of "Mon, 23 Apr 2012 15:26:51 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Christian Ohler <ohler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> None of these arguments are really specific to ERT.  It just seems like
>> you like to run with debug-on-error, which is fine (I do too).
> Just a reminder: running with debug-on-error is a pain since some
> commands raise an error on user input instead of throwing to command
> level.

YMMV but I've been running with debug-on-error for many years and
haven't found it to be a pain.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 23 Apr 2012 13:28:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 23 09:28:16 2012
Received: from localhost ([127.0.0.1]:48610 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SMJJM-0007Tk-Nt
	for submit <at> debbugs.gnu.org; Mon, 23 Apr 2012 09:28:15 -0400
Received: from mail-lb0-f172.google.com ([209.85.217.172]:46209)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <lennart.borgman@HIDDEN>) id 1SMJJI-0007TV-UA
	for 11218 <at> debbugs.gnu.org; Mon, 23 Apr 2012 09:28:10 -0400
Received: by lbgc1 with SMTP id c1so3854503lbg.3
	for <11218 <at> debbugs.gnu.org>; Mon, 23 Apr 2012 06:27:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=FcsgyRaRqBxwzLkn1LyvtMMjGLZVyU/SUUoLyimmbyg=;
	b=mhfc/W/XTGvaxgxhBWq2JoKJo/SKeP6/D6NmAzKjhXIdGXNgyOfTjYBft7075cbPr1
	wboCLX45iZKN3S9Td1G/v4jny9FB9Z7nWn3LSgf6f6Y/84Y9n0JprDEv+8e6xP3wGpuO
	Q+9m0qePQZft/HNrEbl+VrdCorWyN90kPGzqQI26GNvccvLuyTjtDXeZy//WaIzB+ppn
	vlFraKdNnwgtsUL6eoeuaAcZBj5p3hyo3xeDi17E6A5a+BTpXSS35ShRsi/JCNBVc8S+
	JpJnGkfKP6vc2ZOjWNwABtOVZbdPaTMFr14DGVtjrBLkrCwk8Jc/LFRJM6iVfqTzrrVg
	Pa/g==
Received: by 10.152.103.239 with SMTP id fz15mr15267830lab.42.1335187641270;
	Mon, 23 Apr 2012 06:27:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.112.74.232 with HTTP; Mon, 23 Apr 2012 06:26:51 -0700 (PDT)
In-Reply-To: <jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN>
	<4F8DE112.5010106@HIDDEN> <jwvsjg07lbp.fsf-monnier+emacs@HIDDEN>
	<4F90D369.7070005@HIDDEN> <jwvzka61udx.fsf-monnier+emacs@HIDDEN>
	<4F91CEEF.20305@HIDDEN> <jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
From: Lennart Borgman <lennart.borgman@HIDDEN>
Date: Mon, 23 Apr 2012 15:26:51 +0200
Message-ID: <CANbX365dKdVdph9E33dORDgszcx0FsAzr1dez4-bn1_0onQ8YQ@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
To: Stefan Monnier <monnier@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Christian Ohler <ohler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

On Sat, Apr 21, 2012 at 04:34, Stefan Monnier <monnier@HIDDEN> wr=
ote:
>
> None of these arguments are really specific to ERT. =C2=A0It just seems l=
ike
> you like to run with debug-on-error, which is fine (I do too).

Just a reminder: running with debug-on-error is a pain since some
commands raise an error on user input instead of throwing to command
level.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 21 Apr 2012 02:35:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 20 22:35:13 2012
Received: from localhost ([127.0.0.1]:44877 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SLQAK-0005oy-RC
	for submit <at> debbugs.gnu.org; Fri, 20 Apr 2012 22:35:13 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:41404)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SLQAI-0005ok-T8
	for 11218 <at> debbugs.gnu.org; Fri, 20 Apr 2012 22:35:11 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApYIACxOgk/O+K5t/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjBQsLNBIUGA0kLoduBbYyi2GEeQSkRYFdgwM
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="175683849"
Received: from 206-248-174-109.dsl.teksavvy.com (HELO pastel.home)
	([206.248.174.109])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	20 Apr 2012 22:34:36 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id D2DE558E55; Fri, 20 Apr 2012 22:34:34 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Christian Ohler <ohler@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvsjfxstne.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN> <4F91CEEF.20305@HIDDEN>
Date: Fri, 20 Apr 2012 22:34:34 -0400
In-Reply-To: <4F91CEEF.20305@HIDDEN> (Christian Ohler's message of "Fri, 20
	Apr 2012 14:02:39 -0700")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>> I don't see the point of showing that info when running the tests.
>> If the user wants that info, he should be able to easily say "run this
>> test with debug-on-error" so he doesn't only get a backtrace but also
>> gets put in the debugger where he can inspect the state.

> ERT's keyboard shortcut for that is "d".  But it's not a good solution if:

> * the test is nondeterministic (maybe due to subprocess interaction),
> * the test takes a long time to run,
> * you have multiple failing tests and want to quickly compare if they are
> crashing in the same place,
> * ERT is running in batch mode (e.g. make check).

> It's better to collect as much data as reasonably possible when the error
> first occurs.

None of these arguments are really specific to ERT.  It just seems like
you like to run with debug-on-error, which is fine (I do too).
But don't impose it on all ERT users.

>> No: you'll be put in the debugger for the error "a" but if you hit `c'
>> it will continue and re-enter the debugger for error "b".
> My Emacs is a few months old, but that doesn't work for me.  Has it
> changed recently?
[...]
> If `debug-on-error' is t, `with-demoted-errors' becomes essentially
> equivalent to `progn', and (error "b") can ever be reached in

You're right, sorry: brain malfunction.
But that just means you first have to fix the bug that signals "a" before
getting to the bug that signals "b".


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 20 Apr 2012 21:03:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 20 17:03:12 2012
Received: from localhost ([127.0.0.1]:44731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SLKz2-0006Uc-1g
	for submit <at> debbugs.gnu.org; Fri, 20 Apr 2012 17:03:12 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:39783 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ohler@HIDDEN>) id 1SLKyz-0006UV-VV
	for 11218 <at> debbugs.gnu.org; Fri, 20 Apr 2012 17:03:10 -0400
Received: from [2620:0:1002:1009:e2f8:47ff:fe38:3bc8] (port=52984
	helo=dhcp-172-31-155-154.sfo.corp.google.com)
	by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <ohler@HIDDEN>)
	id 1SLKyY-0000AQ-5L; Fri, 20 Apr 2012 17:02:42 -0400
Message-ID: <4F91CEEF.20305@HIDDEN>
Date: Fri, 20 Apr 2012 14:02:39 -0700
From: Christian Ohler <ohler@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
	<jwvzka61udx.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvzka61udx.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

On 4/20/12 5:13 AM, Stefan Monnier wrote:
>>> So the next question is: why does ERT record a backtrace and that extra
>>> information provided by ert-info?
>> To be able to show them to the user, together with the test failure.  If you
>> have one or more failing tests, it's much more useful to see the error
>> messages and backtraces rather than just the error messages.
>
> I don't see the point of showing that info when running the tests.
> If the user wants that info, he should be able to easily say "run this
> test with debug-on-error" so he doesn't only get a backtrace but also
> gets put in the debugger where he can inspect the state.

ERT's keyboard shortcut for that is "d".  But it's not a good solution if:

* the test is nondeterministic (maybe due to subprocess interaction),
* the test takes a long time to run,
* you have multiple failing tests and want to quickly compare if they 
are crashing in the same place,
* ERT is running in batch mode (e.g. make check).

It's better to collect as much data as reasonably possible when the 
error first occurs.


>>    (ert-deftest foo ()
>>      (with-demoted-errors (error "a"))
>>      (error "b"))
>
>> would normally fail with "b", but if we enable debugging to track down why,
>> it will fail with "a" instead (with no way to continue execution to get to
>> the error we are interested in).
>
> No: you'll be put in the debugger for the error "a" but if you hit `c'
> it will continue and re-enter the debugger for error "b".

My Emacs is a few months old, but that doesn't work for me.  Has it 
changed recently?

I'm using

   (defun foo ()
     (with-demoted-errors (error "a"))
     (error "b"))

and typing

   C-u <escape> C-x <escape> : ( f o o ) <return> c c

and all I find in *Messages* is

   error: "a"
   Continue...
   edebug-signal: a

No mention of "b".

If `debug-on-error' is t, `with-demoted-errors' becomes essentially 
equivalent to `progn', and (error "b") can ever be reached in

   (defun foo ()
     (progn (error "a"))
     (error "b"))

since `error' never returns (and I think that's an important guarantee 
that the debugger shouldn't violate, at least not without confirmation).

Christian.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 20 Apr 2012 12:13:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 20 08:13:58 2012
Received: from localhost ([127.0.0.1]:43733 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SLCip-0007zF-IE
	for submit <at> debbugs.gnu.org; Fri, 20 Apr 2012 08:13:57 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:40683)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SLCim-0007z7-Ju
	for 11218 <at> debbugs.gnu.org; Fri, 20 Apr 2012 08:13:54 -0400
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
	[132.204.27.242])
	by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q3KCDQel020176; 
	Fri, 20 Apr 2012 08:13:27 -0400
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
	id 562E5AE201; Fri, 20 Apr 2012 08:13:25 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Christian Ohler <ohler@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvzka61udx.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN> <4F90D369.7070005@HIDDEN>
Date: Fri, 20 Apr 2012 08:13:25 -0400
In-Reply-To: <4F90D369.7070005@HIDDEN> (Christian Ohler's message of "Thu, 19
	Apr 2012 20:09:29 -0700")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4197=0
X-NAI-Spam-Version: 2.2.0.9309 : core <4197> : streams <748467> : uri <1101375>
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

>> So the next question is: why does ERT record a backtrace and that extra
>> information provided by ert-info?
> To be able to show them to the user, together with the test failure.  If you
> have one or more failing tests, it's much more useful to see the error
> messages and backtraces rather than just the error messages.

I don't see the point of showing that info when running the tests.
If the user wants that info, he should be able to easily say "run this
test with debug-on-error" so he doesn't only get a backtrace but also
gets put in the debugger where he can inspect the state.

>   (ert-deftest foo ()
>     (with-demoted-errors (error "a"))
>     (error "b"))

> would normally fail with "b", but if we enable debugging to track down why,
> it will fail with "a" instead (with no way to continue execution to get to
> the error we are interested in).

No: you'll be put in the debugger for the error "a" but if you hit `c'
it will continue and re-enter the debugger for error "b".

> Fundamentally, having conditionals in the code that explicitly check
> debug-on-error' seems like asking for trouble.

I agree it's not something we should do in general, but
with-demoted-error was designed largely for the specific case where
errors should not happen (i.e. if one happens, we want to be able to
debug it easily by setting debug-on-error), but at the same time you
know very well how the program should respond in case of an unexpected
error (so the user who's not in a position to fix the bug can get his
job done).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 20 Apr 2012 03:09:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 19 23:09:59 2012
Received: from localhost ([127.0.0.1]:43150 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SL4ER-0003dI-51
	for submit <at> debbugs.gnu.org; Thu, 19 Apr 2012 23:09:59 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:42423 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ohler@HIDDEN>) id 1SL4EO-0003cy-T2
	for 11218 <at> debbugs.gnu.org; Thu, 19 Apr 2012 23:09:57 -0400
Received: from [204.14.153.109] (port=35838 helo=kamel.local)
	by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <ohler@HIDDEN>)
	id 1SL4E0-00075V-MS; Thu, 19 Apr 2012 23:09:33 -0400
Message-ID: <4F90D369.7070005@HIDDEN>
Date: Thu, 19 Apr 2012 20:09:29 -0700
From: Christian Ohler <ohler@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
	<jwvsjg07lbp.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvsjg07lbp.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Stefan Monnier, 2012-04-19:

>>>>>> If you replace with-demoted-errors with ignore-errors, the test passes.
>>>>> Looks like a bug in ERT.
>>>> I don't know if it's a "bug" per se...
>>>> ert--run-test-internal binds debug-on-error to t, and redefines the
>>>> debugger to ert--run-test-debugger. As the doc of that function says:
>>> I wonder why ERT doesn't just use condition-case to catch and record
>>> the errors.
>> Two reasons that I remember off the top of my head: Recording backtraces,
>> and recording additional information provided with `ert-info'.
>
> So the next question is: why does ERT record a backtrace and that extra
> information provided by ert-info?

To be able to show them to the user, together with the test failure.  If 
you have one or more failing tests, it's much more useful to see the 
error messages and backtraces rather than just the error messages.

Unless there's another way to accomplish this, I think it makes sense 
for ERT to bind `debugger'.  Since `debugger' is only called if 
`debug-on-error' is set, ERT has to bind that, too.

I'm not sure where that leaves us.  You could say the problem is that 
`debug-on-error' is overloaded with two different meanings (one in 
eval.c, one in `condition-case-no-debug'), or you could say that ERT 
wants a different `debugger' hook that does not depend on `debug-on-errors'.

But perhaps `with-demoted-errors' and its interaction with 
`debug-on-error' is inherently problematic -- how would we like it to 
interact with tests and debugging?  Assuming ERT did not rebind 
`debug-on-error', the test

   (ert-deftest foo ()
     (with-demoted-errors (error "a"))
     (error "b"))

would normally fail with "b", but if we enable debugging to track down 
why, it will fail with "a" instead (with no way to continue execution to 
get to the error we are interested in).  Confusing.  As far as ERT tests 
are concerned, one could argue that the current behavior (always fail 
with "a") is preferable because it's more consistent; it just means that 
errors in tests can't be demoted.

Fundamentally, having conditionals in the code that explicitly check 
`debug-on-error' seems like asking for trouble.  If the program checks 
"am I being debugged" and behaves differently in that case, we should 
expect testing and debugging tools to break...

And ERT is not the only tool that triggers the problem: While 
investigating this bug, I set `debug-on-error' to nil globally, typed 
M-: (with-demoted-errors (error "foo")) RET, and was confused for a 
moment that I found myself in the debugger with error "foo" -- 
`with-demoted-errors' had no effect.  This is because M-: rebinds 
`debug-on-error' (at least by default).  Just like ERT.  Edebug does the 
same, too.

Christian.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 19 Apr 2012 07:46:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 19 03:46:29 2012
Received: from localhost ([127.0.0.1]:40803 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SKm4T-0006u5-9W
	for submit <at> debbugs.gnu.org; Thu, 19 Apr 2012 03:46:29 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:51682)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SKm4Q-0006tw-TO
	for 11218 <at> debbugs.gnu.org; Thu, 19 Apr 2012 03:46:27 -0400
Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca
	[132.204.27.242])
	by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q3J7k6Ou002687; 
	Thu, 19 Apr 2012 03:46:07 -0400
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
	id 64141AE152; Thu, 19 Apr 2012 03:46:04 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Christian Ohler <ohler@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvsjg07lbp.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN> <4F8DE112.5010106@HIDDEN>
Date: Thu, 19 Apr 2012 03:46:04 -0400
In-Reply-To: <4F8DE112.5010106@HIDDEN> (Christian Ohler's message of "Tue, 17
	Apr 2012 14:30:58 -0700")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4196=0
X-NAI-Spam-Version: 2.2.0.9309 : core <4196> : streams <748125> : uri <1100874>
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.5 (---)

>>>>> If you replace with-demoted-errors with ignore-errors, the test passes.
>>>> Looks like a bug in ERT.
>>> I don't know if it's a "bug" per se...
>>> ert--run-test-internal binds debug-on-error to t, and redefines the
>>> debugger to ert--run-test-debugger. As the doc of that function says:
>> I wonder why ERT doesn't just use condition-case to catch and record
>> the errors.
> Two reasons that I remember off the top of my head: Recording backtraces,
> and recording additional information provided with `ert-info'.

So the next question is: why does ERT record a backtrace and that extra
information provided by ert-info?


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 17 Apr 2012 21:44:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 17 17:44:42 2012
Received: from localhost ([127.0.0.1]:38796 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SKGCW-0000LK-FD
	for submit <at> debbugs.gnu.org; Tue, 17 Apr 2012 17:44:42 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:54585 ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <ohler@HIDDEN>) id 1SKFzU-0008TO-Rt
	for 11218 <at> debbugs.gnu.org; Tue, 17 Apr 2012 17:31:13 -0400
Received: from [2620:0:1002:1009:e2f8:47ff:fe38:3bc8] (port=56155
	helo=dhcp-172-31-155-154.sfo.corp.google.com)
	by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <ohler@HIDDEN>)
	id 1SKFzJ-0001nK-Ek; Tue, 17 Apr 2012 17:31:01 -0400
Message-ID: <4F8DE112.5010106@HIDDEN>
Date: Tue, 17 Apr 2012 14:30:58 -0700
From: Christian Ohler <ohler@HIDDEN>
MIME-Version: 1.0
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
	<jwvfwc74upn.fsf-monnier+emacs@HIDDEN>
In-Reply-To: <jwvfwc74upn.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
X-Mailman-Approved-At: Tue, 17 Apr 2012 17:44:39 -0400
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

On 4/13/12 6:44 AM, Stefan Monnier wrote:
>>>> If you replace with-demoted-errors with ignore-errors, the test passes.
>>> Looks like a bug in ERT.
>> I don't know if it's a "bug" per se...
>> ert--run-test-internal binds debug-on-error to t, and redefines the
>> debugger to ert--run-test-debugger. As the doc of that function says:
>
> I wonder why ERT doesn't just use condition-case to catch and record
> the errors.

Two reasons that I remember off the top of my head: Recording 
backtraces, and recording additional information provided with 
`ert-info'.  Using condition-case would let ERT regain control only 
after the stack is unwound, at which point that information is gone.

Christian.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 13 Apr 2012 13:45:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 13 09:45:58 2012
Received: from localhost ([127.0.0.1]:56376 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SIgp3-0000hb-VX
	for submit <at> debbugs.gnu.org; Fri, 13 Apr 2012 09:45:58 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:50772)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SIgp2-0000hV-G5
	for 11218 <at> debbugs.gnu.org; Fri, 13 Apr 2012 09:45:56 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApUIACxOgk9sr+di/2dsb2JhbABDuCMDgQyBCIIJAQEEAVYjEAs0EhQYDSSIHAW2MothhHkEpEWBXYMD
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="174058786"
Received: from 108-175-231-98.dsl.teksavvy.com (HELO pastel.home)
	([108.175.231.98])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	13 Apr 2012 09:44:37 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 408AE5809E; Fri, 13 Apr 2012 09:44:37 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Christian Ohler <ohler@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvfwc74upn.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
	<jity0oo5ad.fsf@HIDDEN>
Date: Fri, 13 Apr 2012 09:44:37 -0400
In-Reply-To: <jity0oo5ad.fsf@HIDDEN> (Glenn Morris's message of
	"Thu, 12 Apr 2012 20:15:54 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Glenn Morris <rgm@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>>> If you replace with-demoted-errors with ignore-errors, the test passes.
>> Looks like a bug in ERT.
> I don't know if it's a "bug" per se...
> ert--run-test-internal binds debug-on-error to t, and redefines the
> debugger to ert--run-test-debugger. As the doc of that function says:

I wonder why ERT doesn't just use condition-case to catch and record
the errors.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 13 Apr 2012 00:17:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 12 20:17:14 2012
Received: from localhost ([127.0.0.1]:55211 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SIUCP-00039J-TK
	for submit <at> debbugs.gnu.org; Thu, 12 Apr 2012 20:17:14 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:56683)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1SIUCO-00039D-24
	for 11218 <at> debbugs.gnu.org; Thu, 12 Apr 2012 20:17:12 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1SIUB9-0005YH-3B; Thu, 12 Apr 2012 20:15:55 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
X-Spook: Bruxelles explosion Albright assassinate AVIP Ermes
X-Ran: {5YrsyWknXW%FTa9w)~sdMY,Dd'o:+MYrv]eX_L[Qk,$!BRs^8V_2C,N@5vqGF0@(+Vm+G
X-Hue: blue
X-Attribution: GM
Date: Thu, 12 Apr 2012 20:15:54 -0400
In-Reply-To: <jwvfwcabf0k.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Wed, 11 Apr 2012 09:02:02 -0400")
Message-ID: <jity0oo5ad.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.7 (-----)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.7 (-----)

Stefan Monnier wrote:

>> If you replace with-demoted-errors with ignore-errors, the test passes.
>
> Looks like a bug in ERT.

I don't know if it's a "bug" per se...

ert--run-test-internal binds debug-on-error to t, and redefines the
debugger to ert--run-test-debugger. As the doc of that function says:

  This function records failures and errors and either terminates the
  test silently or calls the interactive debugger, as appropriate.

(Whether or not the "real" debugger is invoked depends on the value of
ert-debug-on-error.)

So basically AFAICS it's an ert design choice that it works by borrowing
the debugger. I don't imagine it would be easy to change that.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 11 Apr 2012 17:58:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 11 13:58:35 2012
Received: from localhost ([127.0.0.1]:52469 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SI1oR-0004Bb-Nw
	for submit <at> debbugs.gnu.org; Wed, 11 Apr 2012 13:58:35 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:53854)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SI1oP-0004BO-SC
	for 11218 <at> debbugs.gnu.org; Wed, 11 Apr 2012 13:58:34 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApUIACxOgk9FxL8q/2dsb2JhbABDuCMDgQyBCIIKAQVWIxALDiYSFBgNJIghtjKLYYR5BKRFgV2DAw
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="173409529"
Received: from 69-196-191-42.dsl.teksavvy.com (HELO pastel.home)
	([69.196.191.42])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	11 Apr 2012 13:57:25 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id DB6F558D2B; Wed, 11 Apr 2012 13:57:24 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvsjga888i.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
	<m3r4vuo4qn.fsf@HIDDEN> <hc62d68crk.fsf@HIDDEN>
	<ohiph6kzbo.fsf@HIDDEN>
Date: Wed, 11 Apr 2012 13:57:24 -0400
In-Reply-To: <ohiph6kzbo.fsf@HIDDEN> (Glenn Morris's message of
	"Wed, 11 Apr 2012 12:28:27 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org, Lars Magne Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

>>>> If I want to debug a condition-case, I'll set debug-on-signal non-nil.
>> That's not an ert bug. :)
> To expand: why does with-demoted-errors use a different form of
> condition-case, and hence treat debugging differently, to the
> pre-existing ignore-errors? The former doesn't let you have control; the
> latter does.

debug-on-signal is inconvenient because it triggers in many cases where
it shouldn't (because the error is actually normal and handled
properly).

`with-demoted-errors' doesn't actually *handle* the error, it just
demotes it so as not to annoy the user.  So I find it makes sense to get
into the debugger when an error is demoted and the user has asked to
enter debugger on error.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 11 Apr 2012 16:29:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 11 12:29:39 2012
Received: from localhost ([127.0.0.1]:52330 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SI0QL-00023g-Vj
	for submit <at> debbugs.gnu.org; Wed, 11 Apr 2012 12:29:39 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:43373)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1SI0QK-00023Y-1x
	for 11218 <at> debbugs.gnu.org; Wed, 11 Apr 2012 12:29:36 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1SI0PD-0007mU-BH; Wed, 11 Apr 2012 12:28:27 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Lars Magne Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<m3r4vuo4qn.fsf@HIDDEN> <hc62d68crk.fsf@HIDDEN>
X-Spook: Hamas INS Jiang Zemin terrorist ASPIC PET spy ASDIC
X-Ran: )tvtL,$mrTHydY2z51{`\bTu:R.*/F+[2KqWw0isPesPRC9{jXS.JxC85Rl,y{N]AvGAB&
X-Hue: cyan
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Wed, 11 Apr 2012 12:28:27 -0400
In-Reply-To: <hc62d68crk.fsf@HIDDEN> (Glenn Morris's message of
	"Wed, 11 Apr 2012 12:16:31 -0400")
Message-ID: <ohiph6kzbo.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Glenn Morris wrote:

>>> If I want to debug a condition-case, I'll set debug-on-signal non-nil.
>
> That's not an ert bug. :)

To expand: why does with-demoted-errors use a different form of
condition-case, and hence treat debugging differently, to the
pre-existing ignore-errors? The former doesn't let you have control; the
latter does.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 11 Apr 2012 16:17:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 11 12:17:45 2012
Received: from localhost ([127.0.0.1]:52311 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SI0Eq-0001lR-DI
	for submit <at> debbugs.gnu.org; Wed, 11 Apr 2012 12:17:44 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:42826)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1SI0Eo-0001lK-5w
	for 11218 <at> debbugs.gnu.org; Wed, 11 Apr 2012 12:17:42 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1SI0Df-0006oj-MJ; Wed, 11 Apr 2012 12:16:31 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Lars Magne Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
	<m3r4vuo4qn.fsf@HIDDEN>
X-Spook: cryptographic Perl-RSA Mena InfoSec ammunition Blowpipe
X-Ran: vE&'1.qGylTdd1c%HT}txUhF!eJ3=4m\adln[RC(-w8fNV4SDUqwirDQg(TUh@@q,ukL9c
X-Hue: green
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Wed, 11 Apr 2012 12:16:31 -0400
In-Reply-To: <m3r4vuo4qn.fsf@HIDDEN> (Lars Magne Ingebrigtsen's
	message of "Wed, 11 Apr 2012 14:03:12 +0200")
Message-ID: <hc62d68crk.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.7 (-----)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.7 (-----)


>> If I want to debug a condition-case, I'll set debug-on-signal non-nil.

That's not an ert bug. :)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 11 Apr 2012 13:03:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 11 09:03:12 2012
Received: from localhost ([127.0.0.1]:50730 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SHxCa-00023L-0y
	for submit <at> debbugs.gnu.org; Wed, 11 Apr 2012 09:03:12 -0400
Received: from ironport-out.teksavvy.com ([206.248.143.162]:7187)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>) id 1SHxCY-00023E-9O
	for 11218 <at> debbugs.gnu.org; Wed, 11 Apr 2012 09:03:10 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApUIACxOgk9FxL8q/2dsb2JhbABDuCMDgQyBCIIKAQVWIxALDiYSFBgNJIghtjKLYYR5BKRFgV2DAw
X-IronPort-AV: E=Sophos;i="4.75,391,1330923600"; d="scan'208";a="173303635"
Received: from 69-196-191-42.dsl.teksavvy.com (HELO pastel.home)
	([69.196.191.42])
	by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
	11 Apr 2012 09:02:02 -0400
Received: by pastel.home (Postfix, from userid 20848)
	id 69C8758D2B; Wed, 11 Apr 2012 09:02:02 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
Message-ID: <jwvfwcabf0k.fsf-monnier+emacs@HIDDEN>
References: <qeobqzc528.fsf@HIDDEN>
Date: Wed, 11 Apr 2012 09:02:02 -0400
In-Reply-To: <qeobqzc528.fsf@HIDDEN> (Glenn Morris's message of
	"Tue, 10 Apr 2012 23:37:03 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

> (defun foo ()
>   (with-demoted-errors (error "error!"))
>   t)
>
> (ert-deftest test-foo ()
>   "Test foo"
>   (should (foo)))
>
> M-x ert RET test-foo RET
>
> Selector: test-foo
> Passed: 0
> Failed: 1 (1 unexpected)
> Total:  1/1
>
> If you replace with-demoted-errors with ignore-errors, the test passes.

Looks like a bug in ERT.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at 11218 <at> debbugs.gnu.org:


Received: (at 11218) by debbugs.gnu.org; 11 Apr 2012 12:04:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 11 08:04:37 2012
Received: from localhost ([127.0.0.1]:50540 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SHwHr-0007Nf-Fu
	for submit <at> debbugs.gnu.org; Wed, 11 Apr 2012 08:04:37 -0400
Received: from hermes.netfonds.no ([80.91.224.195]:54613)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <larsi@HIDDEN>) id 1SHwHo-0007NW-CE
	for 11218 <at> debbugs.gnu.org; Wed, 11 Apr 2012 08:04:33 -0400
Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58]
	helo=stories.gnus.org)
	by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <larsi@HIDDEN>)
	id 1SHwGX-0001WV-ES; Wed, 11 Apr 2012 14:03:13 +0200
From: Lars Magne Ingebrigtsen <larsi@HIDDEN>
To: Glenn Morris <rgm@HIDDEN>
Subject: Re: bug#11218: with-demoted-errors use of condition-case-unless-debug;
	ert
References: <qeobqzc528.fsf@HIDDEN>
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVLIARmJwoqFAAkEACd
	diQ0CQExFwE9GwInEwBOHQXb9tWfAAACUElEQVQ4jWWUsW7bMBCG6aKIkU0sDLvZ0ktBqFtrDVE3
	KyDsB+gL2KxxymijhtiOlYCCYwx00dv2P1KOneZgyOJ94s/j8ZeUvoii+GJtZSfW2gcliWPK90Xx
	+QyK/yIQMTORgG8vQEuGjaPXM1qK8QqUIUCNDEDoTg8jKUOZxKrANRL8G6I2CAgAJCVIcAqiEEfK
	YOBi3iOaOIhSGAOZlD+RAfha0vsbpUZ25pMeK+9/pWf/Wq0tQHMCe1shveuPtprYSo1907AzAGhZ
	Nr5GD6V3FX5xDgCGN3jcxqZKzBLYRdBre4pq7C9AEkqxEK06rhGVziE7A/DHp+vJCyB78UpKHdkL
	JW1XwwzvDygrHXumVDVaYZE6tmTn/aLv+yeF8IdxWkNKq/1+lrhcV7KPBLg++Gbobe0nfAac8Tm2
	S5aqnNzfTqVvOAo5GK4ikLOjjzianJJxHG3jzgnPuiwPXdmVba7FCGY6AF4/kICQh/tlgHk2EUBr
	68RQYrbidwf33l6hu7JGRV0yXUgmNRE43ixpcGP8K4NZA6C0Q0PPUvFKmCKGWzDAJrswvFFiUSjR
	RmffkUqCJdHaQ+rg8nCVcoMicb0CWLm8SwW1ca2yhLxWvH1HuWTnoeU6kvAHnVQ8gVIXZdqZ7uVe
	ZqxVvXSUR0BG75dvcI+mYB9buP4ZbLNpPry4KsspxDW61ui3emruElHv8Zam8ufR1dpmoYYn1Af0
	7x7OhUkBKtVw+RgCN+rTXdHdO/auKL4e9bTe/VyPlV08Xn4A5tT/eB68+jKc4h8qGFCeoM4P9QAA
	AABJRU5ErkJggg==
X-Now-Playing: Zazou, Bikaye & Cy1's _Noir et Blanc_: "M'Pasi Ya M'Pamba"
Date: Wed, 11 Apr 2012 14:03:12 +0200
In-Reply-To: <qeobqzc528.fsf@HIDDEN> (Glenn Morris's message of
	"Tue, 10 Apr 2012 23:37:03 -0400")
Message-ID: <m3r4vuo4qn.fsf@HIDDEN>
User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.1.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-MailScanner-ID: 1SHwGX-0001WV-ES
X-Netfonds-MailScanner: Found to be clean
X-Netfonds-MailScanner-From: larsi@HIDDEN
MailScanner-NULL-Check: 1334750593.88855@yMGcLUixYD8xQ4QLg0o0jQ
X-Spam-Status: No
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11218
Cc: 11218 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Glenn Morris <rgm@HIDDEN> writes:

> with-demoted-errors use of condition-case-unless-debug is annoying.
> If I want to debug a condition-case, I'll set debug-on-signal non-nil.
> As it stands, with-demoted-errors is not useful if you want to write an
> ERT test (for reasons I haven't investigated).

Isn't this an ERT bug, then?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Apr 2012 03:38:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 10 23:38:10 2012
Received: from localhost ([127.0.0.1]:49822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SHoNm-0004XZ-Mx
	for submit <at> debbugs.gnu.org; Tue, 10 Apr 2012 23:38:10 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:51033)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <rgm@HIDDEN>) id 1SHoNl-0004XR-3F
	for submit <at> debbugs.gnu.org; Tue, 10 Apr 2012 23:38:09 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm@HIDDEN>)
	id 1SHoMh-00041a-Bq; Tue, 10 Apr 2012 23:37:03 -0400
From: Glenn Morris <rgm@HIDDEN>
To: submit <at> debbugs.gnu.org
Subject: with-demoted-errors use of condition-case-unless-debug; ert
X-Spook: airframe NATO industrial intelligence CIDA M-14 Islam
X-Ran: ~'KDhM<zsk%Q*Z3~,Lm5blcB8{"BYZP|_3;$+{YGM/qYN7m[^z7vo12;{/z:|If:r?4L*M
X-Hue: white
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Tue, 10 Apr 2012 23:37:03 -0400
Message-ID: <qeobqzc528.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

Package: emacs
Version: 24.0.95

with-demoted-errors use of condition-case-unless-debug is annoying.
If I want to debug a condition-case, I'll set debug-on-signal non-nil.
As it stands, with-demoted-errors is not useful if you want to write an
ERT test (for reasons I haven't investigated).

(defun foo ()
  (with-demoted-errors (error "error!"))
  t)

(ert-deftest test-foo ()
  "Test foo"
  (should (foo)))

M-x ert RET test-foo RET

Selector: test-foo
Passed: 0
Failed: 1 (1 unexpected)
Total:  1/1


If you replace with-demoted-errors with ignore-errors, the test passes.




Report forwarded to bug-gnu-emacs@HIDDEN:
bug#11218; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.