From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Maciej Marcin Piechotka Newsgroups: gmane.emacs.bugs Subject: bug#10629: Infinite loop in emacs 23 on terminal (-nw option) on xgselect.c:58-59 when compiled with gtk+ or gconf support Date: Sat, 28 Jan 2012 17:01:34 +0000 Message-ID: <1327770094.1921.2.camel@localhost.localdomain> References: <1327767888.1934.14.camel@localhost.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-ripemd160"; protocol="application/pgp-signature"; boundary="=-giiev9MwfeOOK+mF7OmS" X-Trace: dough.gmane.org 1327776188 18354 80.91.229.3 (28 Jan 2012 18:43:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 Jan 2012 18:43:08 +0000 (UTC) To: 10629@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 28 19:43:07 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RrDEv-0007Gu-Ak for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jan 2012 19:43:05 +0100 Original-Received: from localhost ([::1]:37540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrDEu-0006jo-Uw for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Jan 2012 13:43:04 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrDDD-0006Xw-PH for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 13:41:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrDDC-0000ep-Jq for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 13:41:19 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrDDC-0000el-Gx for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 13:41:18 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RrDDu-0001iM-E9 for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 13:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Maciej Marcin Piechotka Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2012 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13277761146569 (code B ref -1); Sat, 28 Jan 2012 18:42:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Jan 2012 18:41:54 +0000 Original-Received: from localhost ([127.0.0.1]:48486 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrDDl-0001ht-GX for submit@debbugs.gnu.org; Sat, 28 Jan 2012 13:41:54 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52957) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RrBgA-00072v-W1 for submit@debbugs.gnu.org; Sat, 28 Jan 2012 12:03:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrBfM-00069h-VC for submit@debbugs.gnu.org; Sat, 28 Jan 2012 12:02:17 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:42285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrBfM-00069b-TN for submit@debbugs.gnu.org; Sat, 28 Jan 2012 12:02:16 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:41812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrBfM-0005Rp-05 for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 12:02:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrBfK-00069O-Og for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 12:02:15 -0500 Original-Received: from smtp2.cc.ic.ac.uk ([155.198.5.156]:58152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrBfK-00069C-GQ for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 12:02:14 -0500 Original-Received: from client-86-29-155-99.glfd-bam-2.adsl.virginmedia.com ([86.29.155.99] helo=[192.168.23.104]) by smtp2.cc.ic.ac.uk with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1RrBfG-0007Z1-RS for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2012 17:02:11 +0000 In-Reply-To: <1327767888.1934.14.camel@localhost.localdomain> X-Mailer: Evolution 3.2.3 X-IC-MsgID: 1RrBfG-0007Z1-RS X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Sat, 28 Jan 2012 13:41:51 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Sat, 28 Jan 2012 13:43:03 -0500 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:56135 Archived-At: --=-giiev9MwfeOOK+mF7OmS Content-Type: multipart/mixed; boundary="=-GoBL/DCp2FzHKqqBE6AI" --=-GoBL/DCp2FzHKqqBE6AI Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2012-01-28 at 16:24 +0000, Maciej Marcin Piechotka wrote: > I hit an infinite loop on gselect.c:58-59. After quick debugging I found > that the problem is in loop xgselect.c:58-59: >=20 > while(n_gfds > gfds_size) > gfds_size *=3D 2; >=20 > Problem is that: >=20 > (gdb) p n_gfds > $3 =3D 1 > (gdb) p gfds_size > $4 =3D 0 >=20 > 1. It seems that xgselect_initialize was not called as X system is > initialized. >=20 > 2. Is there a reason why the code is not using (much more efficient but > equivalent) such code in the first place: >=20 > if (ngfds > gfds_size) > { > gfds_size =3D 1 << g_bit_storage (ngfds); > xfree (gfds); > gfds =3D xmalloc (sizeof (*gfds) * gfds_size); > } >=20 > 3. The attached file get rids of initialization at all initializing at > the cost of conditional freeing of gfds (and starting mallocing from 1 > instead of 128). >=20 > Best regards >=20 Ups. Sorry - I forgot to add one file to git index. Corrected patch attached. Best regards --=-GoBL/DCp2FzHKqqBE6AI Content-Disposition: attachment; filename*0=0001-Fix-infinit-loop-when-emacs-is-compiled-with-GTK-sup.pat; filename*1=ch Content-Type: text/x-patch; name="0001-Fix-infinit-loop-when-emacs-is-compiled-with-GTK-sup.patch"; charset="UTF-8" Content-Transfer-Encoding: base64 RnJvbSAzYTA2ZmMyYjQ4ZWI3ZTU1ODM0ZDhlNWU0YWRkYTFmMjI4Njc1OGRiIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQ0KRnJvbTogTWFjaWVqIFBpZWNob3RrYSA8dXp5dGtvd25pazJAZ21haWwu Y29tPg0KRGF0ZTogU2F0LCAyOCBKYW4gMjAxMiAxNjoxMjo0NSArMDAwMA0KU3ViamVjdDogW1BB VENIXSBGaXggaW5maW5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tZ2l0IGEvc3JjL3h0ZXJtLmMgYi9zcmMv eHRlcm0uYw0KaW5kZXggYWY4YWY1MC4uODM0MTJhZSAxMDA2NDQNCi0tLSBhL3NyYy94dGVybS5j DQorKysgYi9zcmMveHRlcm0uYw0KQEAgLTEwOTg5LDggKzEwOTg5LDYgQEAgeF9pbml0aWFsaXpl ICgpDQogICBYU2V0SU9FcnJvckhhbmRsZXIgKHhfaW9fZXJyb3JfcXVpdHRlcik7DQogDQogICBz aWduYWwgKFNJR1BJUEUsIHhfY29ubmVjdGlvbl9zaWduYWwpOw0KLQ0KLSAgeGdzZWxlY3RfaW5p dGlhbGl6ZSAoKTsNCiB9DQogDQogDQotLSANCjEuNy44LjQNCg0K --=-GoBL/DCp2FzHKqqBE6AI-- --=-giiev9MwfeOOK+mF7OmS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQIcBAABAwAGBQJPJCn0AAoJEJIdee2Vr4aPZ3QQALguoHb4852GKWBLKqmbgf10 2GzPQimz6m/u4FAfY0aXj+XFKzNhnqiCpa2rULafdyqzQ5YaBdmTZSDta4+Ut/VN CnzgE9jO/6hLjiNTYr+K7eGmtQoSVVaoCwv96x8rUigCtVPnTtVhljy4UkkG8Kij /E5TWyx9twHq4U4SJXEd4gp8zJ/Nj9drUFZgFXVZzoPKHqNi5a1a6vLFPuHgiBBq zMGspQVjdrfvWNQEUCYKFXB4fLmNnCFD28FQA+vFl13tBj99DkSh3XOqPpJu6Oj5 KWBZxl4xBRQQaWq2Juh3D+WkpmREvWI6fepl2AEiBGa6K9rEO/QZg3GH34VKEsze MpOcIHVo17fFnWGf5lRDnLH5Sw7Mq3gPao3UkJC2/ydKMx47hC9jannNuNW9IySa E2KKP7yKmlmIDFJf6QL+HVzQKIKtKAaWm65vF/PEQl8074k+tAmKL6yqro5Is37g pwvOD6gIieel9dJ82c3hVVNe+b8jI1LVgA+K1oFIpv5blo5SGei4qP8Cf+CK4agp D7ATWuZmb+x92H6gp4In92kTxkHFT5K+b6vnl/f/2a1fADHHNXbTLVFsRKJDv8vo FKdyn4kmWbXL5EuaiU5MxtHbQdvEvnPbsusdaKLqeXcpQN4Tu4vHae3nEuePmNei cHPde3cug/T2ilwUMXkM =3mNO -----END PGP SIGNATURE----- --=-giiev9MwfeOOK+mF7OmS--