From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#9754: emacs -nv fails on glib 2.31 Date: Fri, 14 Oct 2011 13:48:06 -0400 Message-ID: <6zwrc7h3c9.fsf@fencepost.gnu.org> References: <1318609098.30586.7.camel@moonpix.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1318614516 3400 80.91.229.12 (14 Oct 2011 17:48:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2011 17:48:36 +0000 (UTC) Cc: Ryan Lortie To: 9754@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 14 19:48:32 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1REls0-00059K-52 for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Oct 2011 19:48:32 +0200 Original-Received: from localhost ([::1]:40564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RElrz-0005zU-Lh for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Oct 2011 13:48:31 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RElrw-0005yn-62 for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2011 13:48:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RElrv-0006vR-BE for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2011 13:48:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RElrv-0006vK-3k for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2011 13:48:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RElsU-0006ya-3E for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2011 13:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Oct 2011 17:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9754 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9754-submit@debbugs.gnu.org id=B9754.131861452426792 (code B ref 9754); Fri, 14 Oct 2011 17:49:02 +0000 Original-Received: (at 9754) by debbugs.gnu.org; 14 Oct 2011 17:48:44 +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 1RElsC-0006y5-86 for submit@debbugs.gnu.org; Fri, 14 Oct 2011 13:48:44 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RElsA-0006xv-Jv for 9754@debbugs.gnu.org; Fri, 14 Oct 2011 13:48:43 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RElra-0007L2-5l; Fri, 14 Oct 2011 13:48:06 -0400 X-Spook: AVIP broadside Echelon MD5 Albania NWO Albright covert X-Ran: cy;yA[kruesTG#@\dK`PwK&N/;X-V6)xHkj+HHrJ,&TbB"j8@ (Ryan Lortie's message of "Fri, 14 Oct 2011 12:18:18 -0400") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 14 Oct 2011 13:49:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:52647 Archived-At: [ I am resending this report, which was assigned to the wrong package due to a "Packages:"/"Package:" typo, so that it appears on the bug-gnu-emacs list .] From: Ryan Lortie Packages: emacs Version: 23.3 When running "emacs -nw" with the latest glib version, emacs gets stuck in this infinite loop: in xg_select at /usr/src/debug/emacs-23.3/src/xgselect.c:59 58 while (n_gfds > gfds_size) 59 gfds_size *= 2; This code is buggy in the case that gfds_size is zero (since clearly, no matter how many times you multiply by 2, you're not going to increase it). Further down in the same file, you see: 155 void 156 xgselect_initialize () 157 { 158 #if defined (USE_GTK) || defined (HAVE_GCONF) 159 gfds_size = 128; 160 gfds = xmalloc (sizeof (*gfds)*gfds_size); So it's clear that xgselect_initialize() is not being called in the "-nw" case. That makes sense -- why initialise GTK when not using it? The problem is that xg_select() is used even in the "-nw" case, without _initialize() having been called. This worked before because an unused GMainContext used to have 0 fds in it, so n_gfds would be zero and gfds_size would not need to be increased, causing the bug to be skipped over. Recent changes in glib have introduced one fd to every GMainContext to deal with the inherent race introduced by signal delivery (closing a longstanding glib bug). This means that the untouched GMainContext no longer has 0 fds -- but 1. This is what is triggering the problem in the buggy code above. The solution to this problem is one of: - ensure xgselect_initialize() is always called - don't use xg_select in -nw case - fix the code to deal with the array being zero-sized and nuke xgselect_initialize()