From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.lisp.guile.user Subject: Re: guile 2.0.9 build on mingw Date: Tue, 18 Jun 2013 20:17:25 +0300 Message-ID: <834ncvs5i2.fsf@gnu.org> References: <83sj1hv2ml.fsf@gnu.org> <874ndx9y7h.fsf@pobox.com> <83ip2bt4qk.fsf@gnu.org> <8761xqhyyt.fsf@gnu.org> <83li6mt18y.fsf@gnu.org> <83wqq3mcq9.fsf@gnu.org> <87k3m3kor5.fsf@gnu.org> <83ehcalysu.fsf@gnu.org> <87sj0pvl4a.fsf@tines.lan> <837gi1n3v5.fsf@gnu.org> <87k3m1vg8b.fsf@tines.lan> <83txl4lhby.fsf@gnu.org> <8361xjky0f.fsf@gnu.org> <87obb4eo5s.fsf@tines.lan> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1371575922 1844 80.91.229.3 (18 Jun 2013 17:18:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Jun 2013 17:18:42 +0000 (UTC) Cc: ludo@gnu.org, guile-user@gnu.org To: Mark H Weaver Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 18 19:18:42 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UozYE-0006vv-H3 for guile-user@m.gmane.org; Tue, 18 Jun 2013 19:18:38 +0200 Original-Received: from localhost ([::1]:51777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UozYE-0001Gw-3q for guile-user@m.gmane.org; Tue, 18 Jun 2013 13:18:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UozY3-0001De-Mh for guile-user@gnu.org; Tue, 18 Jun 2013 13:18:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UozY2-0007z5-4i for guile-user@gnu.org; Tue, 18 Jun 2013 13:18:27 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:53238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UozY1-0007yp-TJ; Tue, 18 Jun 2013 13:18:26 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MOL00G00MKWKQ00@a-mtaout23.012.net.il>; Tue, 18 Jun 2013 20:17:20 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOL00GB4MOWK720@a-mtaout23.012.net.il>; Tue, 18 Jun 2013 20:17:20 +0300 (IDT) In-reply-to: <87obb4eo5s.fsf@tines.lan> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.175 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10465 Archived-At: > From: Mark H Weaver > Cc: ludo@gnu.org, guile-user@gnu.org > Date: Mon, 17 Jun 2013 11:45:51 -0400 > > Eli Zaretskii writes: > > The bug report at http://bugs.gnu.org/14171 says that when Guile is > > compiled with enable-posix, it "can't start the REPL". Can someone > > please show me a simple way of trying that? > > Just run Guile in such a way that would lead to an interactive Guile > prompt, e.g. by running without any command-line arguments. Ah, so REPL means "read-eval-print loop". It's a bit bizarre to see this acronym used and explained in the Guile reference manual, but not indexed, so please consider the trivial 2-line patch below. > Two people > reported that when built with --enable-posix, Guile would work when run > in a non-interactive way (e.g. using -c or running a script), but would > hang when run interactively. > > As described in , > the problem seems to be in 'call-with-sigint' defined in > ice-9/top-repl.scm. Note that 'call-with-sigint' only installs a signal > handler if POSIX support is enabled, and otherwise is a no-op. > --disable-posix avoided the hang and allowed the REPL to be reached. I looked into this. First of all, the Guile I built without threads, but with --enable-posix does not hang when I invoke it without arguments. It shows me the prompt and allows me to type commands. It also reacts correctly to Ctrl-C. So the fact is that POSIX does not by itself do any harm in the MinGW build. My analysis of this, which included both reading the relevant sources and the above-mentioned bug report, is that the conclusion in that bug report is based on a mistaken interpretation of the reasons for the hang. It is not related to HAVE_POSIX, except accidentally. It's true that call-with-sigint installs a signal handler (by eventually calling scm_sigaction_for_thread) only if HAVE_POSIX is defined. However, nothing in the code of scm_sigaction_for_thread has anything to do with HAVE_POSIX. By contrast, it has _everything_ to do with threads: it calls the same scm_i_ensure_signal_delivery_thread, which unsurprisingly is the same place where I found Guile to hang even in batch mode. When SCM_USE_PTHREAD_THREADS is not defined, scm_i_ensure_signal_delivery_thread is a no-op. Moreover, the backtrace in the bug report clearly shows that Guile hangs in pthread-related functions called from scm_sigaction_for_thread, not in something that is only included if HAVE_POSIX is defined. So I concluded that disabling POSIX just works around that problem, by not installing the signal handler, which avoids calling scm_i_ensure_signal_delivery_thread, but the problem itself, with threads usage, is still there. IOW, it's not the POSIX functionality that is the culprit; it's threads. Which reminds me that it would be nice if someone could comment on the findings and questions I published in http://lists.gnu.org/archive/html/guile-user/2013-06/msg00030.html. Here's the patch for the manual: Improve indexing of "REPL". * doc/ref/scheme-using.texi (Using Guile Interactively): Add index entries for REPL. diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi index 4422c18..350df9c 100644 --- a/doc/ref/scheme-using.texi +++ b/doc/ref/scheme-using.texi @@ -24,6 +24,8 @@ $3 = b @end lisp @noindent +@cindex REPL +@cindex read-eval-print loop This mode of use is called a @dfn{REPL}, which is short for ``Read-Eval-Print Loop'', because the Guile interpreter first reads the expression that you have typed, then evaluates it, and then prints the