GNU bug report logs - #7496
23.2; copy recursive keymap cause crash

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; Severity: minor; Reported by: ARISAWA Akihiro <ari@HIDDEN>; dated Sat, 27 Nov 2010 01:04:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 7496) by debbugs.gnu.org; 27 Nov 2010 05:04:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 27 00:04:56 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PMCy0-0002mj-BG
	for submit <at> debbugs.gnu.org; Sat, 27 Nov 2010 00:04:56 -0500
Received: from mbf.ocn.ne.jp ([122.28.14.167] helo=smtp.mbf.ocn.ne.jp)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <ari@HIDDEN>) id 1PMCxw-0002mU-CI
	for 7496 <at> debbugs.gnu.org; Sat, 27 Nov 2010 00:04:53 -0500
Received: from nagi.lyrical.homelinux.net
	(p3210-ipbf901kokuryo.gunma.ocn.ne.jp [122.24.212.210])
	by smtp.mbf.ocn.ne.jp (Postfix) with ESMTP
	id 85B3E44DC; Sat, 27 Nov 2010 14:10:17 +0900 (JST)
Received: from nagi.lyrical.homelinux.net (localhost [127.0.0.1])
	by nagi.lyrical.homelinux.net (Postfix) with ESMTP id 9A9BE94061;
	Sat, 27 Nov 2010 14:10:40 +0900 (JST)
From: ARISAWA Akihiro <ari@HIDDEN>
To: 7496 <at> debbugs.gnu.org
Subject: Re: bug#7496: 23.2; copy recursive keymap cause crash
In-Reply-To: <jwvhbf3fpgj.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Fri, 26 Nov 2010 22:01:28 -0500")
References: <871v67o9ns.fsf@HIDDEN>
	<jwvhbf3fpgj.fsf-monnier+emacs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)
Date: Sat, 27 Nov 2010 14:10:40 +0900
Message-ID: <87zksvz6zz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -4.6 (----)
X-Debbugs-Envelope-To: 7496
Cc: Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
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/pipermail/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.9 (---)

Stefan Monnier writes:

>> When I call `copy-keymap' with a keymap which contains recursive binding,
>> the emacs crashed.
> - don't use cyclic keymaps and especially don't copy them.
> - don't use copy-keymap, instead: inherit.

OK.
I use cycle binding in global-map, and the evernote-mode.el calls
(copy-keymap global-map).
http://code.google.com/p/emacs-evernote-mode/

So, I will suggest to the author that evernote-mode.el uses
set-keymap-parent instead of copy-keymap.

Regards,
ARISAWA




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7496; Package emacs. Full text available.

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


Received: (at 7496) by debbugs.gnu.org; 27 Nov 2010 02:56:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 26 21:56:08 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PMAxM-0008C4-Ig
	for submit <at> debbugs.gnu.org; Fri, 26 Nov 2010 21:56:08 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]
	helo=ironport2-out.pppoe.ca)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier@HIDDEN>) id 1PMAxF-0008BX-Iw
	for 7496 <at> debbugs.gnu.org; Fri, 26 Nov 2010 21:56:07 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AiQKADsD8ExFxKB0/2dsb2JhbACiEXtyvw6FRwSEXI1t
X-IronPort-AV: E=Sophos;i="4.59,264,1288584000"; d="scan'208";a="83844718"
Received: from 69-196-160-116.dsl.teksavvy.com (HELO ceviche.home)
	([69.196.160.116])
	by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA;
	26 Nov 2010 22:01:28 -0500
Received: by ceviche.home (Postfix, from userid 20848)
	id 3C72D660DC; Fri, 26 Nov 2010 22:01:28 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: ARISAWA Akihiro <ari@HIDDEN>
Subject: Re: bug#7496: 23.2; copy recursive keymap cause crash
Message-ID: <jwvhbf3fpgj.fsf-monnier+emacs@HIDDEN>
References: <871v67o9ns.fsf@HIDDEN>
Date: Fri, 26 Nov 2010 22:01:28 -0500
In-Reply-To: <871v67o9ns.fsf@HIDDEN> (ARISAWA Akihiro's
	message of "Sat, 27 Nov 2010 10:08:39 +0900")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 7496
Cc: 7496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
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/pipermail/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.1 (--)

> When I call `copy-keymap' with a keymap which contains recursive binding,
> the emacs crashed.
> I can reproduce it by following sexp.

> (let ((map (make-sparse-keymap)))
>   (define-key map " " map)
>   (copy-keymap map))

I'm not surprised.  There are many ways to address it:
- try and make sure we better handle the "using up all memory" case
  rather than crashing.  This is very difficult.  We already try to do
  it, but clearly it's not working that well.
- try and detect such cycles and either signal an error or reproduce the
  same cycle in the copy.  We have added such things in several other
  cases, so we should probably do that.
- don't use cyclic keymaps and especially don't copy them.
- don't use copy-keymap, instead: inherit.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7496; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 27 Nov 2010 01:03:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 26 20:03:12 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PM9Bz-000549-DI
	for submit <at> debbugs.gnu.org; Fri, 26 Nov 2010 20:03:12 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <ari@HIDDEN>) id 1PM9Br-00053c-So
	for submit <at> debbugs.gnu.org; Fri, 26 Nov 2010 20:03:05 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ari@HIDDEN>) id 1PM9H7-0006Zt-Sw
	for submit <at> debbugs.gnu.org; Fri, 26 Nov 2010 20:08:26 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:55993)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ari@HIDDEN>) id 1PM9H7-0006Zp-RB
	for submit <at> debbugs.gnu.org; Fri, 26 Nov 2010 20:08:25 -0500
Received: from [140.186.70.92] (port=36149 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PM9H6-0003ij-V6
	for bug-gnu-emacs@HIDDEN; Fri, 26 Nov 2010 20:08:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <ari@HIDDEN>) id 1PM9H5-0006Zd-Rg
	for bug-gnu-emacs@HIDDEN; Fri, 26 Nov 2010 20:08:24 -0500
Received: from mbf.ocn.ne.jp ([122.28.14.167]:52358 helo=smtp.mbf.ocn.ne.jp)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <ari@HIDDEN>) id 1PM9H5-0006ZB-3a
	for bug-gnu-emacs@HIDDEN; Fri, 26 Nov 2010 20:08:23 -0500
Received: from nagi.lyrical.homelinux.net
	(p3210-ipbf901kokuryo.gunma.ocn.ne.jp [122.24.212.210])
	by smtp.mbf.ocn.ne.jp (Postfix) with ESMTP id DA9CE53BA
	for <bug-gnu-emacs@HIDDEN>; Sat, 27 Nov 2010 10:08:17 +0900 (JST)
Received: from nagi.lyrical.homelinux.net (localhost [127.0.0.1])
	by nagi.lyrical.homelinux.net (Postfix) with ESMTP id 8DAAF94061
	for <bug-gnu-emacs@HIDDEN>; Sat, 27 Nov 2010 10:08:40 +0900 (JST)
From: ARISAWA Akihiro <ari@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 23.2; copy recursive keymap cause crash
Date: Sat, 27 Nov 2010 10:08:39 +0900
Message-ID: <871v67o9ns.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: HP-UX 11.00-11.11
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
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/pipermail/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.6 (------)

In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.12)
 of 2010-05-15 on nagi, modified by Debian
configured using `configure  '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Hi,

When I call `copy-keymap' with a keymap which contains recursive binding,
the emacs crashed.
I can reproduce it by following sexp.

(let ((map (make-sparse-keymap)))
  (define-key map " " map)
  (copy-keymap map))

Regards,
ARISAWA




Acknowledgement sent to ARISAWA Akihiro <ari@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7496; 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.