guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1


From: Neil Jerram
Subject: [Guile-commits] GNU Guile branch, branch_release-1-8, updated. release_1-8-6-53-g66f3b6c
Date: Wed, 03 Jun 2009 22:33:41 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=66f3b6c1b043b814663668b5f83210c6e8d1e12d

The branch, branch_release-1-8 has been updated
       via  66f3b6c1b043b814663668b5f83210c6e8d1e12d (commit)
       via  3ed47d2203077ae732fdbdd24c211df6710a8478 (commit)
       via  0310b348a1ebcd0e8aea86606ab6b32ff509d107 (commit)
       via  4a198038b9432f056b24a6d325f21ccac5eb37cc (commit)
       via  93c0c7565893b54edee62f54c1ff5f46ddced311 (commit)
       via  1011599792302b356195663a3efd68a234c11f69 (commit)
       via  5d8f339fd8203f5e2fe001a49592ae12b26b5b67 (commit)
       via  2b76a655663640863319c7c1f39914dabd527291 (commit)
       via  cabfe198fd954fbf1c2afd839fd36eb20a803baf (commit)
      from  e9c9fd3d998135fe8fb5692cd52e196d55c45f5a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 66f3b6c1b043b814663668b5f83210c6e8d1e12d
Author: Neil Jerram <address@hidden>
Date:   Wed May 20 21:55:35 2009 +0100

    Remove possible deadlock in scm_join_thread
    
    * libguile/threads.c (scm_join_thread): Always recheck t->exited
      before calling block_self again, in case thread t has now exited.
    
    * test-suite/tests/threads.test (joining): New test.

commit 3ed47d2203077ae732fdbdd24c211df6710a8478
Author: Neil Jerram <address@hidden>
Date:   Sun Sep 7 16:29:05 2008 +0100

    Avoid "no duplicate" popen tests leaving zombie processes
    
    On the one hand we want the child process in these tests to exit.  On
    the other, we don't want it to exit before the parent Guile code has
    tested the relevant condition (EOF in the first test, broken pipe in
    the second) - because these conditions would obviously be true if the
    child had already exited, and that's not what we're trying to test
    here.  We're trying to test getting EOF and broken pipe while the
    child process is still alive.
    
    * test-suite/tests/popen.test (open-input-pipe:no duplicate): Add
      another pipe from parent to child, so that the child can finish by
      reading from this.  Then the parent controls the child lifetime by
      writing to this pipe.
    
    * test-suite/tests/popen.test (open-output-pipe:no duplicate): Add
      another pipe from child to parent, and have the child finish by
      endlessly writing into this.  Then the parent controls the child
      lifetime by closing its end of the pipe, causing a broken pipe in
      the child.

commit 0310b348a1ebcd0e8aea86606ab6b32ff509d107
Author: Neil Jerram <address@hidden>
Date:   Wed May 20 18:50:52 2009 +0100

    Fix `explicitely' typos, should be `explicitly'

commit 4a198038b9432f056b24a6d325f21ccac5eb37cc
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 12 00:12:18 2009 +0200

    Update `NEWS'.

commit 93c0c7565893b54edee62f54c1ff5f46ddced311
Author: Michael Gran <address@hidden>
Date:   Fri Apr 24 22:23:13 2009 -0700

    Symbols longer than 128 chars can cause an exception.  Also, the 
terminating colon of long postfix keywords are not handled correctly.
    
        * test-suite/tests/reader.test ("read-options"): Add test
        for long postfix keywords.
    
        * libguile/read.c (scm_read_mixed_case_symbol): Fix
        exception on symbols are greater than 128 chars.  Also,
        colons are not stripped from long postfix keywords.

commit 1011599792302b356195663a3efd68a234c11f69
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 12 00:01:30 2009 +0200

    Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130).
    
    * test-suite/tests/time.test ("strftime")["C99 %z
      format"](have-strftime-%z): Better diagnose broken "%z" on Tru64 5.1b
      and AIX.  Closes bug #24130.
    
    * NEWS: Update.

commit 5d8f339fd8203f5e2fe001a49592ae12b26b5b67
Author: Ludovic Courtès <address@hidden>
Date:   Mon May 11 22:54:45 2009 +0200

    Work around lack of flock(2) declaration on Tru64 5.1b.
    
    * configure.in: Check for the declaration of flock(2).
    
    * libguile/posix.c [!__MINGW32__][!HAVE_DECL_FLOCK]: Provide an flock(2)
      declaration, needed on Tru64 5.1b.

commit 2b76a655663640863319c7c1f39914dabd527291
Author: Ludovic Courtès <address@hidden>
Date:   Mon May 11 22:13:29 2009 +0200

    Fix compilation of `test-round.c' on BSD.
    
    * test-suite/standalone/test-round.c (HAVE_MACHINE_FPU_H): Include
      <sys/types.h> when available.  This fixes compilation on NetBSD.
      Reported by Greg Toxel.

commit cabfe198fd954fbf1c2afd839fd36eb20a803baf
Author: Ludovic Courtès <address@hidden>
Date:   Mon May 11 22:11:25 2009 +0200

    Ask for IEEE floating point behavior on Alpha and SH.
    
    * configure.in (CPPFLAGS): Add `-mieee' or `-ieee' on Alpha and SH.
    
    * libguile/numbers.c (guile_ieee_init): Make sure `-mieee' was passed
      when using GCC on Alpha.
    
    * NEWS: Update.

-----------------------------------------------------------------------

Summary of changes:
 ANNOUNCE                           |    2 +-
 NEWS                               |    3 +
 configure.in                       |   38 ++++++++++++-
 doc/maint/guile.texi               |    2 +-
 doc/ref/api-data.texi              |    2 +-
 doc/ref/api-init.texi              |    2 +-
 doc/ref/api-memory.texi            |    4 +-
 doc/ref/api-undocumented.texi      |    2 +-
 doc/ref/libguile-concepts.texi     |    2 +-
 ice-9/deprecated.scm               |    2 +-
 libguile/async.c                   |    2 +-
 libguile/numbers.c                 |    7 ++
 libguile/posix.c                   |    7 ++
 libguile/read.c                    |   15 ++++-
 libguile/strings.c                 |    2 +-
 libguile/threads.c                 |   17 ++---
 test-suite/standalone/test-round.c |    6 ++-
 test-suite/tests/popen.test        |  108 +++++++++++++++++++++++++----------
 test-suite/tests/reader.test       |    5 ++
 test-suite/tests/threads.test      |   34 +++++++++++-
 test-suite/tests/time.test         |   11 ++--
 21 files changed, 210 insertions(+), 63 deletions(-)

diff --git a/ANNOUNCE b/ANNOUNCE
index 89d8cbd..bfbda73 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -30,7 +30,7 @@ The NEWS file is quite long.  Here are the most interesting 
entries:
     from threads that have not been created by Guile.
 
   * Mutexes and condition variables are now always fair.  A recursive
-    mutex must be requested explicitely.
+    mutex must be requested explicitly.
 
   * The low-level thread API has been removed.
 
diff --git a/NEWS b/NEWS
index a65a813..514e978 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ Changes in 1.8.7 (since 1.8.6)
 ** Fix build problem when scm_t_timespec is different from struct timespec
 ** Fix build when compiled with -Wundef -Werror
 ** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
+** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
+** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
+** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
 
 ** Allow @ macro to work with (ice-9 syncase)
 
diff --git a/configure.in b/configure.in
index b53b862..793bf93 100644
--- a/configure.in
+++ b/configure.in
@@ -222,6 +222,40 @@ case "$use_64_calls" in
     ;;
 esac
 
+AC_MSG_CHECKING([whether the compiler defaults to IEEE floating point 
behavior])
+# The following snippet was taken from Gnulib's `fpieee'.  See also the 
definition
+# of `guile_NaN' in `numbers.c'.
+
+# IEEE behaviour is the default on all CPUs except Alpha and SH
+# (according to the test results of Bruno Haible's ieeefp/fenv_default.m4
+# and the GCC 4.1.2 manual).
+case "$host_cpu" in
+alpha*)
+  # On Alpha systems, a compiler option provides the behaviour.
+  # See the ieee(3) manual page, also available at
+  # 
<http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/0600____.HTM>
+  AC_MSG_RESULT([no])
+  if test -n "$GCC"; then
+    # GCC has the option -mieee.
+    CPPFLAGS="$CPPFLAGS -mieee"
+  else
+    # Compaq (ex-DEC) C has the option -ieee.
+    CPPFLAGS="$CPPFLAGS -ieee"
+  fi
+  ;;
+sh*)
+  AC_MSG_RESULT([no])
+  if test -n "$GCC"; then
+    # GCC has the option -mieee.
+    CPPFLAGS="$CPPFLAGS -mieee"
+  fi
+  ;;
+*)
+  AC_MSG_RESULT([yes])
+  ;;
+esac
+
+
 #--------------------------------------------------------------------
 
 dnl Check for dynamic linking
@@ -740,10 +774,12 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 
ctermid fesetround ftime
 #       declaration isn't anywhere.
 #   cuserid - on Tru64 5.1b the declaration is documented to be available
 #       only with `_XOPEN_SOURCE' or some such.
+#   flock - on Tru64 5.1b the declaration is available from <sys/fcntl.h>
+#       but only if `_BSD' is defined.
 #
 AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h 
sys/file.h)
 AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass 
sethostname gethostname)
-AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv, hstrerror, cuserid])
+AC_CHECK_DECLS([sethostname, strncasecmp, unsetenv, hstrerror, cuserid, flock])
 
 # crypt() may or may not be available, for instance in some countries there
 # are restrictions on cryptography.
diff --git a/doc/maint/guile.texi b/doc/maint/guile.texi
index ac08334..4ef4aab 100644
--- a/doc/maint/guile.texi
+++ b/doc/maint/guile.texi
@@ -204,7 +204,7 @@ Execute all thunks from the asyncs of the list 
@var{list_of_a}.
 @deffn {Scheme Procedure} system-async thunk
 @deffnx {C Function} scm_system_async (thunk)
 This function is deprecated.  You can use @var{thunk} directly
-instead of explicitely creating an async object.
+instead of explicitly creating an async object.
 
 @end deffn
 
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index cabe2c5..417ba59 100755
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -331,7 +331,7 @@ integers.
 
 The motivation for this behavior is that the inexactness of a number
 should not be lost silently.  If you want to allow inexact integers,
-you can explicitely insert a call to @code{inexact->exact} or to its C
+you can explicitly insert a call to @code{inexact->exact} or to its C
 equivalent @code{scm_inexact_to_exact}.  (Only inexact integers will
 be converted by this call into exact integers; inexact non-integers
 will become exact fractions.)
diff --git a/doc/ref/api-init.texi b/doc/ref/api-init.texi
index 0e4e8b8..f9714c3 100644
--- a/doc/ref/api-init.texi
+++ b/doc/ref/api-init.texi
@@ -61,7 +61,7 @@ Arrange things so that all of the code in the current thread 
executes as
 if from within a call to @code{scm_with_guile}.  That is, all functions
 called by the current thread can assume that @code{SCM} values on their
 stack frames are protected from the garbage collector (except when the
-thread has explicitely left guile mode, of course).
+thread has explicitly left guile mode, of course).
 
 When @code{scm_init_guile} is called from a thread that already has been
 in guile mode once, nothing happens.  This behavior matters when you
diff --git a/doc/ref/api-memory.texi b/doc/ref/api-memory.texi
index 32d3998..f492203 100644
--- a/doc/ref/api-memory.texi
+++ b/doc/ref/api-memory.texi
@@ -10,7 +10,7 @@
 
 Guile uses a @emph{garbage collector} to manage most of its objects.
 While the garbage collector is designed to be mostly invisible, you 
-sometimes need to interact with it explicitely.
+sometimes need to interact with it explicitly.
 
 See @ref{Garbage Collection} for a general discussion of how garbage
 collection relates to using Guile from C.
@@ -201,7 +201,7 @@ below for a motivation.
 @deftypefn {C Function} void scm_gc_free (void address@hidden, size_t 
@var{size}, const char address@hidden)
 Like @code{free}, but also call @code{scm_gc_unregister_collectable_memory}.
 
-Note that you need to explicitely pass the @var{size} parameter.  This
+Note that you need to explicitly pass the @var{size} parameter.  This
 is done since it should normally be easy to provide this parameter
 (for memory that is associated with GC controlled objects) and this
 frees us from tracking this value in the GC itself, which will keep
diff --git a/doc/ref/api-undocumented.texi b/doc/ref/api-undocumented.texi
index 826b4d3..ef1df19 100644
--- a/doc/ref/api-undocumented.texi
+++ b/doc/ref/api-undocumented.texi
@@ -257,7 +257,7 @@ otherwise return the first argument.
 @deffn {Scheme Procedure} system-async thunk
 @deffnx {C Function} scm_system_async (thunk)
 This function is deprecated.  You can use @var{thunk} directly
-instead of explicitely creating an async object.
+instead of explicitly creating an async object.
 
 @end deffn
 
diff --git a/doc/ref/libguile-concepts.texi b/doc/ref/libguile-concepts.texi
index 6fef7a7..76afd35 100644
--- a/doc/ref/libguile-concepts.texi
+++ b/doc/ref/libguile-concepts.texi
@@ -182,7 +182,7 @@ As explained above, the @code{SCM} type can represent all 
Scheme values.
 Some values fit entirely into a @code{SCM} value (such as small
 integers), but other values require additional storage in the heap (such
 as strings and vectors).  This additional storage is managed
-automatically by Guile.  You don't need to explicitely deallocate it
+automatically by Guile.  You don't need to explicitly deallocate it
 when a @code{SCM} value is no longer used.
 
 Two things must be guaranteed so that Guile is able to manage the
diff --git a/ice-9/deprecated.scm b/ice-9/deprecated.scm
index 91f4d74..27332ba 100644
--- a/ice-9/deprecated.scm
+++ b/ice-9/deprecated.scm
@@ -21,7 +21,7 @@
 (define substring-move-right! substring-move!)
 
 ;; This method of dynamically linking Guile Extensions is deprecated.
-;; Use `load-extension' explicitely from Scheme code instead.
+;; Use `load-extension' explicitly from Scheme code instead.
 
 (define (split-c-module-name str)
   (let loop ((rev '())
diff --git a/libguile/async.c b/libguile/async.c
index 56634d5..104167f 100644
--- a/libguile/async.c
+++ b/libguile/async.c
@@ -177,7 +177,7 @@ scm_async_click ()
 SCM_DEFINE (scm_system_async, "system-async", 1, 0, 0,
             (SCM thunk),
            "This function is deprecated.  You can use @var{thunk} directly\n"
-            "instead of explicitely creating an async object.\n")
+            "instead of explicitly creating an async object.\n")
 #define FUNC_NAME s_scm_system_async
 {
   scm_c_issue_deprecation_warning 
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 37435b5..25b0c1a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -637,6 +637,13 @@ guile_ieee_init (void)
 
 #if defined (HAVE_ISNAN)
 
+#if defined __GNUC__ && defined __alpha__ && !defined _IEEE_FP
+  /* On Alpha GCC must be passed `-mieee' to provide proper NaN handling.
+     See http://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00010.html
+     for more details.  */
+# error NaN handling will not work when compiling without -mieee
+#endif
+
 #ifdef NAN
   /* C99 NAN, when available */
   guile_NaN = NAN;
diff --git a/libguile/posix.c b/libguile/posix.c
index f036f57..2ecd8ae 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1856,6 +1856,13 @@ static int flock (int fd, int operation)
 #endif /* __MINGW32__ */
 
 #if HAVE_FLOCK || defined (__MINGW32__)
+
+#ifndef __MINGW32__
+# if !HAVE_DECL_FLOCK
+extern int flock (int, int);
+# endif
+#endif
+
 SCM_DEFINE (scm_flock, "flock", 2, 0, 0, 
             (SCM file, SCM operation),
            "Apply or remove an advisory lock on an open file.\n"
diff --git a/libguile/read.c b/libguile/read.c
index ff50735..17c0534 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -582,12 +582,21 @@ scm_read_mixed_case_symbol (int chr, SCM port)
 
   if (scm_is_pair (str))
     {
+      size_t len;
+
       str = scm_string_concatenate (scm_reverse_x (str, SCM_EOL));
-      result = scm_string_to_symbol (str);
+      len = scm_c_string_length (str);
 
       /* Per SRFI-88, `:' alone is an identifier, not a keyword.  */
-      if (postfix && ends_with_colon && (scm_c_string_length (result) > 1))
-       result = scm_symbol_to_keyword (result);
+      if (postfix && ends_with_colon && (len > 1))
+       {
+         /* Strip off colon.  */
+         str = scm_c_substring (str, 0, len-1);
+         result = scm_string_to_symbol (str);
+         result = scm_symbol_to_keyword (result);
+       }
+      else
+       result = scm_string_to_symbol (str);
     }
   else
     {
diff --git a/libguile/strings.c b/libguile/strings.c
index c138026..012e08b 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1069,7 +1069,7 @@ scm_i_deprecated_string_chars (SCM str)
                    "SCM_STRING_CHARS does not work with shared substrings.",
                    SCM_EOL);
 
-  /* We explicitely test for read-only strings to produce a better
+  /* We explicitly test for read-only strings to produce a better
      error message.
   */
 
diff --git a/libguile/threads.c b/libguile/threads.c
index fc3e607..3d6df11 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -934,17 +934,14 @@ SCM_DEFINE (scm_join_thread, "join-thread", 1, 0, 0,
   scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
 
   t = SCM_I_THREAD_DATA (thread);
-  if (!t->exited)
+  while (!t->exited)
     {
-      while (1)
-       {
-         block_self (t->join_queue, thread, &thread_admin_mutex, NULL);
-         if (t->exited)
-           break;
-         scm_i_pthread_mutex_unlock (&thread_admin_mutex);
-         SCM_TICK;
-         scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
-       }
+      block_self (t->join_queue, thread, &thread_admin_mutex, NULL);
+      if (t->exited)
+       break;
+      scm_i_pthread_mutex_unlock (&thread_admin_mutex);
+      SCM_TICK;
+      scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
     }
   res = t->result;
 
diff --git a/test-suite/standalone/test-round.c 
b/test-suite/standalone/test-round.c
index f9b4077..1340fff 100644
--- a/test-suite/standalone/test-round.c
+++ b/test-suite/standalone/test-round.c
@@ -26,7 +26,11 @@
 #if HAVE_FENV_H
 #include <fenv.h>
 #elif defined HAVE_MACHINE_FPU_H
-/* On Tru64 5.1b, the declaration of fesetround(3) is here.  */
+/* On Tru64 5.1b, the declaration of fesetround(3) is in <machine/fpu.h>.
+   On NetBSD, this header has to be included along with <sys/types.h>.  */
+# ifdef HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+# endif
 # include <machine/fpu.h>
 #endif
 
diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test
index 1dd2bc7..08bfa7c 100644
--- a/test-suite/tests/popen.test
+++ b/test-suite/tests/popen.test
@@ -73,20 +73,46 @@
              (open-input-pipe "echo hello"))))))
     #t)
   
+  (pass-if "open-input-pipe process gets (current-input-port) as stdin"
+    (let* ((p2c (pipe))
+           (port (with-input-from-port (car p2c)
+                   (lambda ()
+                     (open-input-pipe "read && echo $REPLY")))))
+      (display "hello\n" (cdr p2c))
+      (force-output (cdr p2c))
+      (let ((result (eq? (read port) 'hello)))
+       (close-port (cdr p2c))
+       (close-pipe port)
+       result)))
+
   ;; After the child closes stdout (which it indicates here by writing
-  ;; "closed" to stderr), the parent should see eof.  In Guile 1.6.4 and
-  ;; earlier a duplicate of stdout existed in the child, meaning eof was not
-  ;; seen.
+  ;; "closed" to stderr), the parent should see eof.  In Guile 1.6.4
+  ;; and earlier a duplicate of stdout existed in the child, meaning
+  ;; eof was not seen.
+  ;;
+  ;; Note that the objective here is to test that the parent sees EOF
+  ;; while the child is still alive.  (It is obvious that the parent
+  ;; must see EOF once the child has died.)  The use of the `p2c'
+  ;; pipe, and `echo closed' and `read' in the child, allows us to be
+  ;; sure that we are testing what the parent sees at a point where
+  ;; the child has closed stdout but is still alive.
   (pass-if "no duplicate"
-    (let* ((pair (pipe))
-          (port (with-error-to-port (cdr pair)
+    (let* ((c2p (pipe))
+          (p2c (pipe))
+          (port (with-error-to-port (cdr c2p)
                   (lambda ()
-                    (open-input-pipe
-                     "exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; 
sleep 999")))))
-      (close-port (cdr pair))   ;; write side
-      (and (char? (read-char (car pair))) ;; wait for child to do its thing
-          (char-ready? port)
-          (eof-object? (read-char port))))))
+                    (with-input-from-port (car p2c)
+                      (lambda ()
+                        (open-input-pipe
+                         "exec 1>/dev/null; echo closed 1>&2; exec 
2>/dev/null; read")))))))
+      (close-port (cdr c2p))   ;; write side
+      (let ((result (eof-object? (read-char port))))
+       (display "hello!\n" (cdr p2c))
+       (force-output (cdr p2c))
+       (close-pipe port)
+       result)))
+
+  )
 
 ;;
 ;; open-output-pipe
@@ -121,27 +147,47 @@
     #t)
   
   ;; After the child closes stdin (which it indicates here by writing
-  ;; "closed" to stderr), the parent should see a broken pipe.  We setup to
-  ;; see this as EPIPE (rather than SIGPIPE).  In Guile 1.6.4 and earlier a
-  ;; duplicate of stdin existed in the child, preventing the broken pipe
-  ;; occurring.
+  ;; "closed" to stderr), the parent should see a broken pipe.  We
+  ;; setup to see this as EPIPE (rather than SIGPIPE).  In Guile 1.6.4
+  ;; and earlier a duplicate of stdin existed in the child, preventing
+  ;; the broken pipe occurring.
+  ;;
+  ;; Note that the objective here is to test that the parent sees a
+  ;; broken pipe while the child is still alive.  (It is obvious that
+  ;; the parent will see a broken pipe once the child has died.)  The
+  ;; use of the `c2p' pipe, and the repeated `echo closed' in the
+  ;; child, allows us to be sure that we are testing what the parent
+  ;; sees at a point where the child has closed stdin but is still
+  ;; alive.
+  ;;
+  ;; Note that `with-epipe' must apply only to the parent and not to
+  ;; the child process; we rely on the child getting SIGPIPE, to
+  ;; terminate it (and avoid leaving a zombie).
   (pass-if "no duplicate"
-    (with-epipe
-     (lambda ()
-       (let* ((pair (pipe))
-             (port (with-error-to-port (cdr pair)
-                     (lambda ()
-                       (open-output-pipe
-                        "exec 0</dev/null; echo closed 1>&2; exec 2>/dev/null; 
sleep 999")))))
-        (close-port (cdr pair))   ;; write side
-        (and (char? (read-char (car pair))) ;; wait for child to do its thing
-             (catch 'system-error
-               (lambda ()
-                 (write-char #\x port)
-                 (force-output port)
-                 #f)
-               (lambda (key name fmt args errno-list)
-                 (= (car errno-list) EPIPE)))))))))
+    (let* ((c2p (pipe))
+          (port (with-error-to-port (cdr c2p)
+                  (lambda ()
+                    (open-output-pipe
+                     "exec 0</dev/null; while true; do echo closed 1>&2; 
done")))))
+      (close-port (cdr c2p))   ;; write side
+      (with-epipe
+       (lambda ()
+        (let ((result
+               (and (char? (read-char (car c2p))) ;; wait for child to do its 
thing
+                    (catch 'system-error
+                           (lambda ()
+                             (write-char #\x port)
+                             (force-output port)
+                             #f)
+                           (lambda (key name fmt args errno-list)
+                             (= (car errno-list) EPIPE))))))
+          ;; Now close our reading end of the pipe.  This should give
+          ;; the child a broken pipe and so allow it to exit.
+          (close-port (car c2p))
+          (close-pipe port)
+          result)))))
+
+  )
 
 ;;
 ;; close-pipe
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test
index b068c71..0b6f9a4 100644
--- a/test-suite/tests/reader.test
+++ b/test-suite/tests/reader.test
@@ -165,6 +165,11 @@
          (with-read-options '(keywords postfix)
            (lambda ()
              (read-string "keyword:")))))
+  (pass-if "long postfix keywords"
+    (eq? 
#:keyword0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+         (with-read-options '(keywords postfix)
+           (lambda ()
+             (read-string 
"keyword0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789:")))))
   (pass-if "`:' is not a postfix keyword (per SRFI-88)"
     (eq? ':
          (with-read-options '(keywords postfix)
diff --git a/test-suite/tests/threads.test b/test-suite/tests/threads.test
index 0146016..34ee7ee 100644
--- a/test-suite/tests/threads.test
+++ b/test-suite/tests/threads.test
@@ -133,4 +133,36 @@
                                (lambda (n) (set! result (cons n result)))
                                (lambda (n) (* 2 n))
                                '(0 1 2 3 4 5))
-           (equal? result '(10 8 6 4 2 0)))))))
+           (equal? result '(10 8 6 4 2 0)))))
+
+      ;;
+      ;; thread joining
+      ;;
+
+      (with-test-prefix "joining"
+
+       ;; scm_join_thread has a SCM_TICK in the middle of it, to
+       ;; allow asyncs to run (including signal delivery).  We used
+       ;; to have a bug whereby if the joined thread terminated at
+       ;; the same time as the joining thread is in this SCM_TICK,
+       ;; scm_join_thread would not notice and would hang forever.
+       ;; So in this test we are setting up the following sequence of
+       ;; events.
+        ;;   T=0  other thread is created and starts running
+       ;;   T=2  main thread sets up an async that will sleep for 10 seconds
+        ;;   T=2  main thread calls join-thread, which will...
+        ;;   T=2  ...call the async, which starts sleeping
+        ;;   T=5  other thread finishes its work and terminates
+        ;;   T=7  async completes, main thread continues inside join-thread.
+       (pass-if "don't hang when joined thread terminates in SCM_TICK"
+         (let ((other-thread (make-thread sleep 5)))
+           (letrec ((delay-count 10)
+                    (aproc (lambda ()
+                             (set! delay-count (- delay-count 1))
+                             (if (zero? delay-count)
+                                 (sleep 5)
+                                 (system-async-mark aproc)))))
+             (sleep 2)
+             (system-async-mark aproc)
+             (join-thread other-thread)))
+         #t))))
diff --git a/test-suite/tests/time.test b/test-suite/tests/time.test
index ebc4499..0007952 100644
--- a/test-suite/tests/time.test
+++ b/test-suite/tests/time.test
@@ -1,7 +1,7 @@
 ;;;; time.test --- test suite for Guile's time functions     -*- scheme -*-
 ;;;; Jim Blandy <address@hidden> --- June 1999, 2004
 ;;;;
-;;;;   Copyright (C) 1999, 2004, 2006, 2007 Free Software Foundation, Inc.
+;;;;   Copyright (C) 1999, 2004, 2006, 2007, 2009 Free Software Foundation, 
Inc.
 ;;;; 
 ;;;; This program is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -222,12 +222,13 @@
 
     ;; C99 spec is empty string if no zone determinable
     ;;
-    ;; on pre-C99 systems not sure what to expect if %z unsupported, probably
-    ;; "%z" unchanged in C99 if timezone
+    ;; On pre-C99 systems not sure what to expect if %z unsupported, probably
+    ;; "%z" unchanged in C99 if timezone.  On AIX and Tru64 5.1b, it returns
+    ;; a string such as "GMT" or "EST", instead of "+0000" or "-0500".  See
+    ;; https://savannah.gnu.org/bugs/index.php?24130 for details.
     ;;
     (define have-strftime-%z
-      (not (member (strftime "%z" (gmtime 0))
-                  '("" "%z"))))
+      (equal? (strftime "%z" (gmtime 0)) "+0000"))
 
     ;; %z here is quite possibly affected by the same tm:gmtoff vs current
     ;; zone as %Z above is, so in the following tests we make them the same.


hooks/post-receive
-- 
GNU Guile




reply via email to

[Prev in Thread] Current Thread [Next in Thread]