From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lawrence Mitchell Newsgroups: gmane.emacs.bugs Subject: bug#6378: all-completions Segfault Date: Tue, 08 Jun 2010 17:37:47 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1276016312 11737 80.91.229.12 (8 Jun 2010 16:58:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Jun 2010 16:58:32 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 08 18:58:31 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OM289-0006t6-Fi for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Jun 2010 18:58:25 +0200 Original-Received: from localhost ([127.0.0.1]:47908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM288-0002gx-Lv for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Jun 2010 12:58:24 -0400 Original-Received: from [140.186.70.92] (port=51358 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM27v-0002do-9t for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:58:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM27t-0005HF-NO for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:58:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37810) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM27t-0005HB-Lw for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:58:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OM1rJ-0005jD-TT; Tue, 08 Jun 2010 12:41:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Lawrence Mitchell Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Jun 2010 16:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6378 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.127601523822011 (code B ref -1); Tue, 08 Jun 2010 16:41:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Jun 2010 16:40:38 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM1qw-0005iy-7l for submit@debbugs.gnu.org; Tue, 08 Jun 2010 12:40:38 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM1qu-0005ip-Eb for submit@debbugs.gnu.org; Tue, 08 Jun 2010 12:40:37 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:57071) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OM1qp-0002Ye-Tl for submit@debbugs.gnu.org; Tue, 08 Jun 2010 12:40:31 -0400 Original-Received: from [140.186.70.92] (port=49992 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM1qo-0000PU-GG for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:40:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM1qm-00021j-V2 for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:40:30 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:41575) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM1qm-00021U-GE for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 12:40:28 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OM1qh-0004Dk-74 for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2010 18:40:23 +0200 Original-Received: from garnet.epcc.ed.ac.uk ([129.215.56.222]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Jun 2010 18:40:23 +0200 Original-Received: from wence by garnet.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Jun 2010 18:40:23 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 70 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: garnet.epcc.ed.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (usg-unix-v) Cancel-Lock: sha1:rpaLk5v7RMpvqRC61vsKhOUbOiE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 08 Jun 2010 12:41:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37606 Archived-At: Nathan Weizenbaum wrote: > This segfaults me on GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, GTK+ Version > 2.16.1) of 2010-05-09: > (all-completions "" []) > I think the problem is on line 1593 of src/minibuf.c, but my > Emacs-innards-fu isn't good enough to attempt a fix. I think this patch should fix things diff --git a/src/minibuf.c b/src/minibuf.c index ad81bfd..1d93901 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1590,7 +1590,7 @@ with a space are ignored unless STRING itself starts with a space. */) if (type == 2) { obsize = XVECTOR (collection)->size; - bucket = XVECTOR (collection)->contents[index]; + bucket = obsize == 0 ? zero : XVECTOR (collection)->contents[index]; } while (1) Although I don't understand why the code-path for the vector version can't be simplified as in the following patch, which also fixes the problem AFAICT: diff --git a/src/minibuf.c b/src/minibuf.c index ad81bfd..c6aae27 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1610,22 +1610,14 @@ with a space are ignored unless STRING itself starts with a space. */) } else if (type == 2) { - if (!EQ (bucket, zero)) - { - elt = bucket; - eltstring = elt; - if (XSYMBOL (bucket)->next) - XSETSYMBOL (bucket, XSYMBOL (bucket)->next); - else - XSETFASTINT (bucket, 0); - } - else if (++index >= obsize) - break; - else - { - bucket = XVECTOR (collection)->contents[index]; - continue; - } + if ( index < obsize ) + { + elt = bucket; + eltstring = elt; + bucket = XVECTOR (collection)->contents[++index]; + } + else + break; } else /* if (type == 3) */ { Cheers, Lawrence -- Lawrence Mitchell