GNU bug report logs - #21633
25.0.50; assertion failure, self-insert-command with negative argument

Previous Next

Package: emacs;

Reported by: Nicolas Richard <youngfrog <at> members.fsf.org>

Date: Tue, 6 Oct 2015 09:19:02 UTC

Severity: normal

Found in version 25.0.50

Done: Andreas Schwab <schwab <at> suse.de>

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 21633 in the body.
You can then email your comments to 21633 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#21633; Package emacs. (Tue, 06 Oct 2015 09:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Richard <youngfrog <at> members.fsf.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Oct 2015 09:19:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <youngfrog <at> members.fsf.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 11:11:58 +0200
Using the build mentionned below (i.e. built today) :

emacs -Q
Hit: C-- * (or C-- C-1 *)
=> crash (assertion failed)

Here's my gdb session, when setting a breakpoint :

Breakpoint 3, Fself_insert_command (n=9223372036854775807) at cmds.c:308
308	  CHECK_NUMBER (n);
(gdb) p n
$10 = 9223372036854775807
(gdb) xpr
Lisp_Int1
$11 = -1
(gdb) p CHECK_NUMBER (n)
$12 = void
(gdb) n
310	  if (XFASTINT (n) < 0)
(gdb) p XFASTINT (n)
$13 = 4611686018427387903
(gdb) xpr
Lisp_Misc
warning: value truncated
Cannot access memory at address 0xffffffff

At this point I realize I understand nothing about C and gdb. Anyway, I
say "next" and see that the above `if' statement failed to find the obvious
error :

(gdb) n
313	  if (XFASTINT (n) < 2)
(gdb) l
308	  CHECK_NUMBER (n);
309	
310	  if (XFASTINT (n) < 0)
311	    error ("Negative repetition argument %"pI"d", XFASTINT (n));
312	
313	  if (XFASTINT (n) < 2)
314	    remove_excessive_undo_boundaries ();
315	
316	  /* Barf if the key that invoked this was not a character.  */
317	  if (!CHARACTERP (last_command_event))
(gdb) 

Now I don't know what to do.

In GNU Emacs 25.0.50.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2015-10-06
Repository revision: 25b4572073179c8d6dc980ce2df3db4d96cd692f
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Gentoo Base System release 2.2

Configured using:
 'configure --with-x-toolkit=lucid --enable-checking --with-wide-int
 'CFLAGS= -O0 -g3''

Configured features:
XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS LUCID X11

Important settings:
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix

-- 
Nicolas Richard




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21633; Package emacs. (Tue, 06 Oct 2015 09:43:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Nicolas Richard <youngfrog <at> members.fsf.org>
Cc: 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 11:42:47 +0200
Nicolas Richard <youngfrog <at> members.fsf.org> writes:

> (gdb) p XFASTINT (n)
> $13 = 4611686018427387903
> (gdb) xpr
> Lisp_Misc
> warning: value truncated
> Cannot access memory at address 0xffffffff
>
> At this point I realize I understand nothing about C and gdb.

XFASTINT unboxes the Lisp_Object.  The value is a plain number.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Reply sent to Andreas Schwab <schwab <at> suse.de>:
You have taken responsibility. (Tue, 06 Oct 2015 09:55:02 GMT) Full text and rfc822 format available.

Notification sent to Nicolas Richard <youngfrog <at> members.fsf.org>:
bug acknowledged by developer. (Tue, 06 Oct 2015 09:55:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> suse.de>
To: Nicolas Richard <youngfrog <at> members.fsf.org>
Cc: 21633-done <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 11:54:20 +0200
Fixed in 0befeb0.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21633; Package emacs. (Tue, 06 Oct 2015 12:26:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <youngfrog <at> members.fsf.org>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 14:26:32 +0200
Andreas Schwab <schwab <at> suse.de> writes:
> XFASTINT unboxes the Lisp_Object.  The value is a plain number.

So XFASTINT (n) in this case should be -1 instead of
4611686018427387903. Thanks for the information and for fixing the bug.

As an additionnal information, please note that this seems related to
--with-wide-int (at least I get proper error reporting when not using
this option). Shouldn't XFASTINT be made to work in that case instead of
using XINT ?

-- 
Nico




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

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

From: Andreas Schwab <schwab <at> suse.de>
To: Nicolas Richard <youngfrog <at> members.fsf.org>
Cc: 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 14:44:55 +0200
Nicolas Richard <youngfrog <at> members.fsf.org> writes:

> As an additionnal information, please note that this seems related to
> --with-wide-int (at least I get proper error reporting when not using
> this option). Shouldn't XFASTINT be made to work in that case instead of
> using XINT ?

XFASTINT is only defined for non-negative Lisp_Int.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




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

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicolas Richard <youngfrog <at> members.fsf.org>
Cc: schwab <at> suse.de, 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 18:07:19 +0300
> From: Nicolas Richard <youngfrog <at> members.fsf.org>
> Date: Tue, 06 Oct 2015 14:26:32 +0200
> Cc: 21633 <at> debbugs.gnu.org
> 
> Thanks for the information and for fixing the bug.

Would you like to write a test for this bug?

TIA




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21633; Package emacs. (Tue, 06 Oct 2015 15:49:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <youngfrog <at> members.fsf.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: schwab <at> suse.de, 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 17:48:54 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Nicolas Richard <youngfrog <at> members.fsf.org>
>> Date: Tue, 06 Oct 2015 14:26:32 +0200
>> Cc: 21633 <at> debbugs.gnu.org
>> 
>> Thanks for the information and for fixing the bug.
>
> Would you like to write a test for this bug?

I would add

(ert-deftest core-elisp-self-insert-command-with-negative-argument ()
  "Test `self-insert-command' with a negative argument."
  (let ((last-command-event ?a))
    (should-error (self-insert-command -1))))

to test/automated/core-elisp-tests.el.

I didn't find a better place. WDYT ?

-- 
Nico.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21633; Package emacs. (Tue, 06 Oct 2015 16:02:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicolas Richard <youngfrog <at> members.fsf.org>
Cc: schwab <at> suse.de, 21633 <at> debbugs.gnu.org
Subject: Re: bug#21633: 25.0.50;
 assertion failure, self-insert-command with negative argument
Date: Tue, 06 Oct 2015 19:01:04 +0300
> From: Nicolas Richard <youngfrog <at> members.fsf.org>
> Cc:  schwab <at> suse.de,  21633 <at> debbugs.gnu.org
> Date: Tue, 06 Oct 2015 17:48:54 +0200
> 
> > Would you like to write a test for this bug?
> 
> I would add
> 
> (ert-deftest core-elisp-self-insert-command-with-negative-argument ()
>   "Test `self-insert-command' with a negative argument."
>   (let ((last-command-event ?a))
>     (should-error (self-insert-command -1))))

Yep.

> to test/automated/core-elisp-tests.el.
> 
> I didn't find a better place. WDYT ?

I thought about cmds-tests.el, a new file for the stuff in cmds.c (a
kind-of promise for the future ;-).  But I don't insist, it's up to
you.

Thanks.




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

This bug report was last modified 9 years and 228 days ago.

Previous Next


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