fix race condition in 00-repl-server.test (#1412931)

This commit is contained in:
Miroslav Lichvar 2017-02-13 16:55:58 +01:00
parent cf59c773fd
commit 962a433200
2 changed files with 35 additions and 0 deletions

33
guile-repltest.patch Normal file
View File

@ -0,0 +1,33 @@
commit 2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4
Author: Ludovic Courtès <ludo@gnu.org>
Date: Fri Nov 4 22:45:51 2016 +0100
tests: Avoid race condition in REPL server test.
Fixes <http://bugs.gnu.org/24769>.
Reported by Rob Browning <rlb@defaultvalue.org>.
* test-suite/tests/00-repl-server.test ("simple expression"): Add call
to 'select' before 'display'.
diff --git a/test-suite/tests/00-repl-server.test b/test-suite/tests/00-repl-server.test
index 1f570a9..4b5ec0c 100644
--- a/test-suite/tests/00-repl-server.test
+++ b/test-suite/tests/00-repl-server.test
@@ -105,8 +105,14 @@ reached."
"scheme@(repl-server)> $1 = 42\n"
(with-repl-server socket
(read-until-prompt socket %last-line-before-prompt)
- (display "(+ 40 2)\n(quit)\n" socket)
- (read-string socket)))
+
+ ;; 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

View File

@ -15,6 +15,7 @@ Requires(preun): /sbin/install-info
Requires: coreutils
Patch1: guile-multilib.patch
Patch2: guile-repltest.patch
%description
GUILE (GNU's Ubiquitous Intelligent Language for Extension) is a library
@ -43,6 +44,7 @@ install the guile package.
%prep
%setup -q -n guile-%version
%patch1 -p1 -b .multilib
%patch2 -p1 -b .repltest
%build