GNU bug report logs - #9754
emacs -nv fails on glib 2.31

Previous Next

Package: emacs;

Reported by: Ryan Lortie <desrt <at> desrt.ca>

Date: Fri, 14 Oct 2011 17:43:01 UTC

Severity: normal

Tags: moreinfo

Merged with 6975, 10631

Fixed in version 24.2

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ryan Lortie <desrt <at> desrt.ca>
Subject: bug#9754: closed (Re: bug#9754: Issue with Emacs 23.4)
Date: Sat, 19 May 2012 21:58:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#9754: emacs -nv fails on glib 2.31

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 9754 <at> debbugs.gnu.org.

-- 
9754: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9754
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ken Brown <kbrown <at> cornell.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Achim Gratz <Stromeko <at> nexgo.de>, 9754-done <at> debbugs.gnu.org
Subject: Re: bug#9754: Issue with Emacs 23.4
Date: Sat, 19 May 2012 17:56:33 -0400
Version: 24.2

I've committed the change as bzr revision 108316, and I'm closing the bug.

Ken




[Message part 3 (message/rfc822, inline)]
From: Ryan Lortie <desrt <at> desrt.ca>
To: submit <at> debbugs.gnu.org
Subject: emacs -nv fails on glib 2.31
Date: Fri, 14 Oct 2011 12:18:18 -0400
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()




This bug report was last modified 12 years and 109 days ago.

Previous Next


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