unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Mark H Weaver <mhw@netris.org>
Cc: ludo@gnu.org, guile-user@gnu.org
Subject: Re: guile 2.0.9 build on mingw
Date: Tue, 18 Jun 2013 20:17:25 +0300	[thread overview]
Message-ID: <834ncvs5i2.fsf@gnu.org> (raw)
In-Reply-To: <87obb4eo5s.fsf@tines.lan>

> From: Mark H Weaver <mhw@netris.org>
> Cc: ludo@gnu.org,  guile-user@gnu.org
> Date: Mon, 17 Jun 2013 11:45:51 -0400
> 
> Eli Zaretskii <eliz@gnu.org> 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 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14171#14>,
> 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



  reply	other threads:[~2013-06-18 17:17 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 19:46 guile 2.0.9 build on mingw Panicz Maciej Godek
2013-05-20 20:05 ` Eli Zaretskii
2013-05-20 20:46   ` Andy Wingo
2013-05-20 21:09     ` objc
2013-05-21  2:43       ` Eli Zaretskii
2013-05-22 15:26     ` Eli Zaretskii
2013-06-07  8:37       ` Eli Zaretskii
2013-06-07 12:44       ` Ludovic Courtès
2013-06-07 14:59         ` Eli Zaretskii
2013-06-09 17:10           ` Eli Zaretskii
2013-06-09 20:33             ` Ludovic Courtès
2013-06-09 21:16               ` Andy Wingo
2013-06-09 21:35                 ` Ludovic Courtès
2013-06-10 16:18                   ` Eli Zaretskii
2013-06-10 16:18                 ` Eli Zaretskii
2013-06-10 16:23               ` Eli Zaretskii
2013-06-10 19:09                 ` Mark H Weaver
2013-06-10 19:49                   ` Eli Zaretskii
2013-06-10 20:54                     ` Mark H Weaver
2013-06-11 16:53                       ` Eli Zaretskii
2013-06-11 22:11                         ` Ludovic Courtès
2013-06-12 17:46                           ` Eli Zaretskii
2013-06-18 21:51                             ` Why launch the Guile signal delivery thread on exit? (was Re: guile 2.0.9 build on mingw) Mark H Weaver
2013-06-19 15:51                               ` Eli Zaretskii
2013-06-19 16:06                               ` Julian Graham
2013-06-19 19:20                               ` Ludovic Courtès
2013-06-12 17:57                         ` guile 2.0.9 build on mingw Eli Zaretskii
2013-06-13 13:26                           ` Eli Zaretskii
2013-06-16 14:19                             ` Ludovic Courtès
2013-06-13 13:33                           ` Eli Zaretskii
2013-06-16 14:36                             ` Ludovic Courtès
2013-06-16 15:40                               ` Eli Zaretskii
2013-06-16 14:55                             ` Ludovic Courtès
2013-06-16 15:47                               ` Eli Zaretskii
2013-06-16 18:59                                 ` Ludovic Courtès
2013-06-13 13:40                           ` Eli Zaretskii
2013-06-16 14:59                             ` Ludovic Courtès
2013-06-17 15:41                               ` Eli Zaretskii
2013-06-18 20:45                                 ` Ludovic Courtès
2013-06-18 22:28                                   ` Mark H Weaver
2013-06-19  3:03                                     ` Eli Zaretskii
2013-06-19 19:26                                     ` Ludovic Courtès
2013-06-19 20:02                                       ` Eli Zaretskii
2013-06-19  2:59                                   ` Eli Zaretskii
2013-06-19 15:56                                   ` Eli Zaretskii
2013-06-19 19:38                                     ` Ludovic Courtès
2013-06-13 13:41                           ` Eli Zaretskii
2013-06-16 15:04                             ` Ludovic Courtès
2013-06-16 15:48                               ` Eli Zaretskii
2013-06-16 14:44                           ` Ludovic Courtès
2013-06-16 15:41                             ` Eli Zaretskii
2013-06-12 17:59                         ` Eli Zaretskii
2013-06-16 14:46                           ` Ludovic Courtès
2013-06-12 18:02                         ` Eli Zaretskii
2013-06-16 19:50                           ` Ludovic Courtès
2013-06-16 20:22                             ` Eli Zaretskii
2013-06-17 15:45                           ` Mark H Weaver
2013-06-18 17:17                             ` Eli Zaretskii [this message]
2013-06-18 19:31                               ` Eli Zaretskii
2013-06-18 20:19                                 ` Ludovic Courtès
2013-06-19  2:53                                   ` Eli Zaretskii
2013-06-19 19:28                                     ` Ludovic Courtès
2013-06-19 19:56                                       ` Eli Zaretskii
2013-05-26 20:41     ` Panicz Maciej Godek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834ncvs5i2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).