GNU bug report logs - #25187
Initialization of `shell-mode-map' is not safe

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: Alexander Shukaev <emacs@HIDDEN>; Keywords: easy; dated Mon, 12 Dec 2016 23:13:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) easy. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 12 Dec 2016 23:12:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 12 18:12:34 2016
Received: from localhost ([127.0.0.1]:39731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cGZlq-00067w-C2
	for submit <at> debbugs.gnu.org; Mon, 12 Dec 2016 18:12:34 -0500
Received: from eggs.gnu.org ([208.118.235.92]:56930)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <emacs@HIDDEN>) id 1cGZi6-00062H-7r
 for submit <at> debbugs.gnu.org; Mon, 12 Dec 2016 18:08:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <emacs@HIDDEN>) id 1cGZi0-0001yg-6l
 for submit <at> debbugs.gnu.org; Mon, 12 Dec 2016 18:08:37 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:34742)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <emacs@HIDDEN>)
 id 1cGZi0-0001yc-35
 for submit <at> debbugs.gnu.org; Mon, 12 Dec 2016 18:08:36 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47896)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <emacs@HIDDEN>) id 1cGZhy-0006wx-V6
 for bug-gnu-emacs@HIDDEN; Mon, 12 Dec 2016 18:08:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <emacs@HIDDEN>) id 1cGZhv-0001xm-Pi
 for bug-gnu-emacs@HIDDEN; Mon, 12 Dec 2016 18:08:34 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56565)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <emacs@HIDDEN>)
 id 1cGZhv-0001xT-K3
 for bug-gnu-emacs@HIDDEN; Mon, 12 Dec 2016 18:08:31 -0500
Received: from mfilter36-d.gandi.net (mfilter36-d.gandi.net [217.70.178.167])
 by relay7-d.mail.gandi.net (Postfix) with ESMTP id 47CE4B82
 for <bug-gnu-emacs@HIDDEN>; Tue, 13 Dec 2016 00:08:28 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mfilter36-d.gandi.net
Received: from relay7-d.mail.gandi.net ([IPv6:::ffff:217.70.183.200])
 by mfilter36-d.gandi.net (mfilter36-d.gandi.net [::ffff:10.0.15.180])
 (amavisd-new, port 10024)
 with ESMTP id xLoW0a4sDkc7 for <bug-gnu-emacs@HIDDEN>;
 Tue, 13 Dec 2016 00:08:26 +0100 (CET)
X-Originating-IP: 88.68.181.111
Received: from [192.168.3.110]
 (dslb-088-068-181-111.088.068.pools.vodafone-ip.de [88.68.181.111])
 (Authenticated sender: forum@HIDDEN)
 by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id D1D88298
 for <bug-gnu-emacs@HIDDEN>; Tue, 13 Dec 2016 00:08:25 +0100 (CET)
To: bug-gnu-emacs@HIDDEN
From: Alexander Shukaev <emacs@HIDDEN>
Subject: Initialization of `shell-mode-map' is not safe
Message-ID: <49c53840-659f-5e60-a1d9-161a7e1d8004@HIDDEN>
Date: Tue, 13 Dec 2016 00:08:07 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 12 Dec 2016 18:12:33 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hi,

consider

(defvar shell-mode-map
   (let ((map (nconc (make-sparse-keymap) comint-mode-map)))
     (define-key map "\C-c\C-f" 'shell-forward-command)
     (define-key map "\C-c\C-b" 'shell-backward-command)
     (define-key map "\t" 'completion-at-point)
     (define-key map (kbd "M-RET") 'shell-resync-dirs)
     (define-key map "\M-?" 'comint-dynamic-list-filename-completions)
     (define-key map [menu-bar completion]
       (cons "Complete"
	    (copy-keymap (lookup-key comint-mode-map [menu-bar completion]))))
     (define-key-after (lookup-key map [menu-bar completion])
       [complete-env-variable] '("Complete Env. Variable Name" .
				shell-dynamic-complete-environment-variable)
       'complete-file)
     (define-key-after (lookup-key map [menu-bar completion])
       [expand-directory] '("Expand Directory Reference" .
			   shell-replace-by-expanded-directory)
       'complete-expand)
     map))

from 'shell.el'.  When somebody decides to customize `comint-mode-map' 
by, for example, first wiping it out and then filling it again,

(with-eval-after-load 'comint	
   ;; Wipe `comint-mode-map':
   (setcdr comint-mode-map nil)
   ;; Fill `comint-mode-map':
   ...)

then when the `shell' feature is loaded, it will inevitably fail because 
`(lookup-key comint-mode-map [menu-bar completion])' may no longer 
return a keymap but rather nil or a number.

Looking forward for fix.

Regards,
Alexander




Acknowledgement sent to Alexander Shukaev <emacs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#25187; 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: Mon, 12 Jun 2017 00:45:01 UTC

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