unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#36340: Test failures when networking is disabled
@ 2019-06-23 11:44 Cyprien Nicolas
  2019-06-24 12:35 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Cyprien Nicolas @ 2019-06-23 11:44 UTC (permalink / raw)
  To: 36340

Hello,

Guile's configure script offers an option to disable networking support,
but when disabled, some test won't pass.

-----8<-----8<-----8<-----8<-----8<-----
Running 00-repl-server.test
ERROR: 00-repl-server.test: repl-server: simple expression - arguments:
((unbound-variable #f "Unbound variable: ~S" (make-socket-address) #f))
ERROR: 00-repl-server.test: repl-server: HTTP inter-protocol attack -
arguments: ((unbound-variable #f "Unbound variable: ~S"
(make-socket-address) #f))
----->8----->8----->8----->8----->8-----

The error is obviously related to the configure option. I have a patch
for catching unbound-variable and throw unresolved instead, tested on
2.2 and 2.0 branches. Reference: https://bugs.gentoo.org/629004

That patch is enough for stable-2.0 but there is another failure in
suspendable-ports in 2.2.5, as the suspendable-ports ice-9 module
overrides accept and connect functions, missing when networking is disabled.

-----8<-----8<-----8<-----8<-----8<-----
$ guile-2.2
GNU Guile 2.2.5
Copyright (C) 1995-2019 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (ice-9 suspendable-ports))
While compiling expression:
In procedure public-lookup: No variable bound to accept in module (guile)
----->8----->8----->8----->8----->8-----

Is guile configured with --disable-networking still a supported
configuration?

Thanks,
Cyprien





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36340: Test failures when networking is disabled
  2019-06-23 11:44 bug#36340: Test failures when networking is disabled Cyprien Nicolas
@ 2019-06-24 12:35 ` Ludovic Courtès
  2019-07-07 13:26   ` Cyprien Nicolas
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2019-06-24 12:35 UTC (permalink / raw)
  To: Cyprien Nicolas; +Cc: 36340

Hi Cyprien!  :-)

Cyprien Nicolas <cyprien@nicolas.tf> skribis:

> Is guile configured with --disable-networking still a supported
> configuration?

In theory yes, but as you found out, it’s not well tested.

The way we’d normally addressing in the test suite is by testing:

  (provided? 'socket)

and/or:

  (provided? 'net-db)

and throwing to unresolved or skipping tests altogether.

Would you like to propose a patch that does that for all the instances
that you found?

Thanks!

Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#36340: Test failures when networking is disabled
  2019-06-24 12:35 ` Ludovic Courtès
@ 2019-07-07 13:26   ` Cyprien Nicolas
  0 siblings, 0 replies; 3+ messages in thread
From: Cyprien Nicolas @ 2019-07-07 13:26 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 36340

[-- Attachment #1: Type: text/plain, Size: 1018 bytes --]

On 24/06/2019 14:35, Ludovic Courtès wrote:
> Hi Cyprien!  :-)
> 
> Cyprien Nicolas <cyprien@nicolas.tf> skribis:
> 
>> Is guile configured with --disable-networking still a supported
>> configuration?
> 
> In theory yes, but as you found out, it’s not well tested.
> 
> The way we’d normally addressing in the test suite is by testing:
> 
>    (provided? 'socket)
> 
> and/or:
> 
>    (provided? 'net-db)
> 
> and throwing to unresolved or skipping tests altogether.
> 
> Would you like to propose a patch that does that for all the instances
> that you found?

Do you mean also harmonizing current tests that uses

     (memq 'socket *features*) ; web-uri.test

and/or

     (defined? 'AF_INET) ; 00-socket.test

or only fixing failing ones?

The attached path mimics net-db.test style for skipping tests for
00-repl-server.test (I hope the indentation is correct).

However, we still have the ice-9 suspendable-ports module issue which
compiles fine but fails to load (actually not related to tests).

Thanks,

[-- Attachment #2: guile-tests-00-repl-server.patch --]
[-- Type: text/x-patch, Size: 3726 bytes --]

--- guile-2.2.6/test-suite/tests/00-repl-server.test.old	2017-04-14 23:26:40.000000000 +0200
+++ guile-2.2.6/test-suite/tests/00-repl-server.test	2019-07-07 15:14:59.681831790 +0200
@@ -105,47 +105,48 @@
 ;;; Since we call 'primitive-fork', these tests must run before any
 ;;; tests that create threads.
 
-(with-test-prefix "repl-server"
+(if (provided? 'socket)
+    (with-test-prefix "repl-server"
 
-  (pass-if-equal "simple expression"
-      "scheme@(repl-server)> $1 = 42\n"
-    (with-repl-server socket
-      (read-until-prompt socket %last-line-before-prompt)
-
-      ;; Wait until 'repl-reader' in boot-9 has written the prompt.
-      ;; Otherwise, if we write too quickly, 'repl-reader' checks for
-      ;; 'char-ready?' and doesn't print the prompt.
-      (match (select (list socket) '() (list socket) 3)
-        (((_) () ())
-         (display "(+ 40 2)\n(quit)\n" socket)
-         (read-string socket)))))
-
-  (pass-if "HTTP inter-protocol attack"           ;CVE-2016-8606
-    (with-repl-server socket
-      ;; Avoid SIGPIPE when the server closes the connection.
-      (sigaction SIGPIPE SIG_IGN)
-
-      (read-until-prompt socket %last-line-before-prompt)
-
-      ;; Simulate an HTTP inter-protocol attack.
-      (write-request (build-request (string->uri "http://localhost"))
-                     socket)
-
-      ;; Make sure the server reacts by closing the connection.  If it
-      ;; fails to do that, this test hangs.
-      (catch 'system-error
-        (lambda ()
-          (let loop ((n 0))
-            (display "(+ 40 2)\n(quit)\n" socket) ;trigger EPIPE
-            (read-string socket)
-            (if (> n 5)
-                #f                                ;failure
-                (begin
-                  (sleep 1)
-                  (loop (+ 1 n))))))
-        (lambda args
-          (->bool (memv (system-error-errno args)
-                        (list ECONNRESET EPIPE ECONNABORTED))))))))
+      (pass-if-equal "simple expression"
+          "scheme@(repl-server)> $1 = 42\n"
+        (with-repl-server socket
+          (read-until-prompt socket %last-line-before-prompt)
+
+          ;; Wait until 'repl-reader' in boot-9 has written the prompt.
+          ;; Otherwise, if we write too quickly, 'repl-reader' checks for
+          ;; 'char-ready?' and doesn't print the prompt.
+          (match (select (list socket) '() (list socket) 3)
+            (((_) () ())
+             (display "(+ 40 2)\n(quit)\n" socket)
+             (read-string socket)))))
+
+      (pass-if "HTTP inter-protocol attack"           ;CVE-2016-8606
+        (with-repl-server socket
+          ;; Avoid SIGPIPE when the server closes the connection.
+          (sigaction SIGPIPE SIG_IGN)
+
+          (read-until-prompt socket %last-line-before-prompt)
+
+          ;; Simulate an HTTP inter-protocol attack.
+          (write-request (build-request (string->uri "http://localhost"))
+                         socket)
+
+          ;; Make sure the server reacts by closing the connection.  If it
+          ;; fails to do that, this test hangs.
+          (catch 'system-error
+            (lambda ()
+              (let loop ((n 0))
+                (display "(+ 40 2)\n(quit)\n" socket) ;trigger EPIPE
+                (read-string socket)
+                (if (> n 5)
+                    #f                                ;failure
+                    (begin
+                      (sleep 1)
+                      (loop (+ 1 n))))))
+            (lambda args
+              (->bool (memv (system-error-errno args)
+                            (list ECONNRESET EPIPE ECONNABORTED)))))))))
 
 ;;; Local Variables:
 ;;; eval: (put 'with-repl-server 'scheme-indent-function 1)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-07 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23 11:44 bug#36340: Test failures when networking is disabled Cyprien Nicolas
2019-06-24 12:35 ` Ludovic Courtès
2019-07-07 13:26   ` Cyprien Nicolas

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).