From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Fix hanging of popen.test Date: Thu, 10 Jun 2010 23:54:56 +0100 Message-ID: <1276210496-6477-1-git-send-email-neil@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1276210577 23354 80.91.229.12 (10 Jun 2010 22:56:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Jun 2010 22:56:17 +0000 (UTC) Cc: Neil Jerram To: Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jun 11 00:56:13 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OMqfO-0004uD-JO for guile-devel@m.gmane.org; Fri, 11 Jun 2010 00:56:06 +0200 Original-Received: from localhost ([127.0.0.1]:56930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMqfO-0007kW-5e for guile-devel@m.gmane.org; Thu, 10 Jun 2010 18:56:06 -0400 Original-Received: from [140.186.70.92] (port=34093 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMqfG-0007iL-65 for guile-devel@gnu.org; Thu, 10 Jun 2010 18:55:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMqfE-0006oz-Vq for guile-devel@gnu.org; Thu, 10 Jun 2010 18:55:58 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:52768) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMqfE-0006kz-OM for guile-devel@gnu.org; Thu, 10 Jun 2010 18:55:56 -0400 Original-Received: from arudy (host86-163-100-238.range86-163.btcentralplus.com [86.163.100.238]) by mail3.uklinux.net (Postfix) with ESMTP id 5FA881F676F for ; Thu, 10 Jun 2010 23:55:19 +0100 (BST) Original-Received: by arudy (Postfix, from userid 1000) id 8245538013; Thu, 10 Jun 2010 23:55:18 +0100 (BST) X-Mailer: git-send-email 1.7.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10462 Archived-At: The "open-output-pipe":"no duplicate" test has been hanging, on and off, and not completely reliably, for a few years. It's now doing so fairly reliably for me, and investigation shows that - the child shell process is in a tight loop (99% CPU) - the parent Guile process is stuck calling waitpid(). The problem is that the child hasn't got the SIGPIPE that the test intends, and so is continuing to echo "closed" forever; and Guile is waiting for it to terminate, forever. I haven't fully debugged the SIGPIPE problem, but it sounds very like what Chet Ramey describes here: http://old.nabble.com/Re%3A-SIGPIPE-not-properly-reset-with-%27trap---PIPE%27-p20985595.html. (And my version of bash is 3.2.39.) So, a fix should be to use something other than shell to implement the child; and it appears that this works. * check-guile.in (TEST_SUITE_DIR): Export. * test-suite/tests/popen-child.scm: New script file. * test-suite/tests/popen.test ("open-output-pipe", "no duplicate"): Use Guile for the child process, instead of shell. --- check-guile.in | 1 + test-suite/tests/popen-child.scm | 4 ++++ test-suite/tests/popen.test | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test-suite/tests/popen-child.scm diff --git a/check-guile.in b/check-guile.in index dde51b3..fc670e1 100644 --- a/check-guile.in +++ b/check-guile.in @@ -15,6 +15,7 @@ top_builddir=@top_builddir_absolute@ top_srcdir=@top_srcdir_absolute@ TEST_SUITE_DIR=${top_srcdir}/test-suite +export TEST_SUITE_DIR if [ x"$1" = x-i ] ; then guile=$2 diff --git a/test-suite/tests/popen-child.scm b/test-suite/tests/popen-child.scm new file mode 100644 index 0000000..4bfe6b7 --- /dev/null +++ b/test-suite/tests/popen-child.scm @@ -0,0 +1,4 @@ +(close-port (current-input-port)) +(let loop () + (display "closed\n" (current-error-port)) + (force-output (current-error-port))) diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test index 0a20cff..a408c9e 100644 --- a/test-suite/tests/popen.test +++ b/test-suite/tests/popen.test @@ -167,8 +167,9 @@ (let* ((c2p (pipe)) (port (with-error-to-port (cdr c2p) (lambda () - (open-output-pipe - "exec 0&2; done"))))) + (open-output-pipe (format #f + "guile -s ~a/tests/popen-child.scm" + (getenv "TEST_SUITE_DIR"))))))) (close-port (cdr c2p)) ;; write side (with-epipe (lambda () -- 1.7.1