Subject: bug#40075: patch

From: Matt Wette <[email-masked]>
Date: Sat, 21 Mar 2020 09:43:40 -0700

Below is a patch against guile-3.0.1.

"make" works, "make check" works.

null-threads.c was not seeing "SCM_USE_NULL_THREADS" so include 
libguile/scmconfig.h
null-threads.c was not seeing def of SCM_API so include "libguile/scm.h"
web-server.test used (if (provided? 'threads) <test>) so #undefined if 
no threads.

--- libguile/null-threads.h-orig    2020-03-21 08:12:37.852229565 -0700
+++ libguile/null-threads.h    2020-03-21 08:33:26.239759647 -0700
@@ -36,6 +36,8 @@
  #include <signal.h>
  #include <errno.h>

+#include "libguile/scm.h"
+
  /* Threads
  */
  typedef int scm_i_pthread_t;
--- libguile/null-threads.c-orig    2020-03-21 08:07:50.113439437 -0700
+++ libguile/null-threads.c    2020-03-21 08:08:32.681573253 -0700
@@ -23,6 +23,7 @@

  #include <stdlib.h>

+#include "libguile/scmconfig.h"

  #if SCM_USE_NULL_THREADS
  #include "null-threads.h"
--- test-suite/tests/web-server.test-orig    2020-03-21 
09:29:57.688813542 -0700
+++ test-suite/tests/web-server.test    2020-03-21 09:35:08.850651216 -0700
@@ -93,25 +93,25 @@
      "not found"
    (expect http-get "/does-not-exist" 404))

-(pass-if-equal "GET with keep-alive"
-    '("Hello, λ world!"
-      "Écrit comme ça en Latin-1."
-      "GNU Guile")
-  (if (provided? 'threads)
+(if (provided? 'threads)
+    (pass-if-equal "GET with keep-alive"
+      '("Hello, λ world!"
+    "Écrit comme ça en Latin-1."
+    "GNU Guile")
        (let ((port (open-socket-for-uri %server-base-uri)))
-        (define result
-          (map (lambda (path)
-                 (let-values (((response body)
-                               (http-get (string-append 
%server-base-uri path)
-                                         #:port port
-                                         #:keep-alive? #t
-                                         #:headers
-                                         '((user-agent . "GNU Guile")))))
-                   (and (= (response-code response) 200)
-                        body)))
-               '("/" "/latin1" "/user-agent")))
-        (close-port port)
-        result)))
+    (define result
+      (map (lambda (path)
+         (let-values (((response body)
+                   (http-get (string-append %server-base-uri path)
+                     #:port port
+                     #:keep-alive? #t
+                     #:headers
+                     '((user-agent . "GNU Guile")))))
+           (and (= (response-code response) 200)
+            body)))
+           '("/" "/latin1" "/user-agent")))
+    (close-port port)
+    result)))

  (pass-if-equal "POST /"
      "forbidden"