GNU bug report logs - #20066
24.4; should-error and cl-assert

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Mon, 9 Mar 2015 08:07:02 UTC

Severity: normal

Found in version 24.4

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20066 in the body.
You can then email your comments to 20066 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Mon, 09 Mar 2015 08:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 09 Mar 2015 08:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4; should-error and cl-assert
Date: Mon, 09 Mar 2015 16:06:44 +0800
I just compiled emacs 25.0.50 from git and I have immediately noticed
the following difference:

1. (should-error (error "yes"))
2. (should-error (cl-assert nil t))

Test 1 succeeds but test 2 fails. In emacs 24.4, both tests succeed.
Could someone investigate what have caused this incompatibility?

Thanks,
Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Mon, 09 Mar 2015 16:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 20066 <at> debbugs.gnu.org (full text, mbox):

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 20066 <at> debbugs.gnu.org
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Mon, 09 Mar 2015 17:12:35 +0100
On Mon, Mar 09 2015, Leo Liu wrote:

> I just compiled emacs 25.0.50 from git and I have immediately noticed
> the following difference:
>
> 1. (should-error (error "yes"))
> 2. (should-error (cl-assert nil t))
>
> Test 1 succeeds but test 2 fails. In emacs 24.4, both tests succeed.
> Could someone investigate what have caused this incompatibility?

commit 61b4c22c6eba96718327a0d208a8492d8bad76e0
Author: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date:   Sat Feb 14 00:46:29 2015 -0500

[...]
    (cl--assertion-failed): New function.

+(defun cl--assertion-failed (form &optional string sargs args)
+  (if debug-on-error
+      (debug `(cl-assertion-failed ,form ,string ,@sargs))


So, `debug' is explicitly called now, which circumvents the normal
call-chain: signal > maybe_call_debugger > call_debugger > debug




Added indication that bug 20066 blocks19759 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 09 Mar 2015 19:41:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Tue, 07 Apr 2015 07:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 20066 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: 20066 <at> debbugs.gnu.org
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 15:44:45 +0800
On 2015-03-09 16:06 +0800, Leo Liu wrote:
> I just compiled emacs 25.0.50 from git and I have immediately noticed
> the following difference:
>
> 1. (should-error (error "yes"))
> 2. (should-error (cl-assert nil t))
>
> Test 1 succeeds but test 2 fails. In emacs 24.4, both tests succeed.
> Could someone investigate what have caused this incompatibility?
>
> Thanks,
> Leo

Any comments on this bug?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Tue, 07 Apr 2015 12:46:02 GMT) Full text and rfc822 format available.

Message #16 received at 20066 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 20066 <at> debbugs.gnu.org
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 14:47:00 +0200
Leo Liu <sdl.web <at> gmail.com> writes:
> Any comments on this bug?

Hi,

I can't seem to reproduce :

 $ src/emacs --version
GNU Emacs 25.0.50.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
 $ src/emacs --batch -l ert --eval '(should-error (cl-assert nil t))'; echo $?
0
 $ src/emacs --batch -l ert --eval '(should-error (error "yes"))'; echo $?
0
 $ src/emacs --batch -l ert --eval '(should-error nil)'; echo $?
Test failed: ((should-error nil) :form nil :value nil :fail-reason "did not signal an error")
255

-- 
Nicolas Richard




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Tue, 07 Apr 2015 13:10:03 GMT) Full text and rfc822 format available.

Message #19 received at 20066 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 20066 <at> debbugs.gnu.org, Leo Liu <sdl.web <at> gmail.com>
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 15:10:38 +0200
Nicolas Richard <theonewiththeevillook <at> yahoo.fr> writes:
>  $ src/emacs --version
> GNU Emacs 25.0.50.1

Forgot to mention I was at commit
7c691f32f78303750d29972a29dcc6754fae257a from a few days ago.

Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20066; Package emacs. (Wed, 08 Apr 2015 02:06:02 GMT) Full text and rfc822 format available.

Message #22 received at 20066 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 20066 <at> debbugs.gnu.org
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Tue, 07 Apr 2015 22:05:11 -0400
>> 1. (should-error (error "yes"))
>> 2. (should-error (cl-assert nil t))
>> Test 1 succeeds but test 2 fails.

I think test 2 is incorrect.  It assumes that when cl-assert fails it
reacts by throwing a "normal" signal that can be caught like any other.
This is untrue for example when we decide to compile-away the assertions
(depending on speed ans safety settings).

cl-assert should be used to check impossible situations and an assertion
failure is just supposed to bring it to the user's attention to help
debug the code.  It is not meant to be caught&handled like a normal
signal.


        Stefan




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Wed, 08 Apr 2015 04:16:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Wed, 08 Apr 2015 04:16:02 GMT) Full text and rfc822 format available.

Message #27 received at 20066-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 20066-done <at> debbugs.gnu.org
Subject: Re: bug#20066: 24.4; should-error and cl-assert
Date: Wed, 08 Apr 2015 12:15:38 +0800
On 2015-04-08 10:05 +0800, Stefan Monnier wrote:
> I think test 2 is incorrect.  It assumes that when cl-assert fails it
> reacts by throwing a "normal" signal that can be caught like any other.
> This is untrue for example when we decide to compile-away the assertions
> (depending on speed ans safety settings).
>
> cl-assert should be used to check impossible situations and an assertion
> failure is just supposed to bring it to the user's attention to help
> debug the code.  It is not meant to be caught&handled like a normal
> signal.

OK, that makes sense.

Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 May 2015 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 49 days ago.

Previous Next


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