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: Re: "no duplicate" in `popen.test' Date: Mon, 17 Mar 2008 22:55:32 +0000 Message-ID: <87od9dc657.fsf@ossau.uklinux.net> References: <87wso5livc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1205794565 13406 80.91.229.12 (17 Mar 2008 22:56:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Mar 2008 22:56:05 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Mar 17 23:56:33 2008 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.50) id 1JbOFg-0002at-QY for guile-devel@m.gmane.org; Mon, 17 Mar 2008 23:56:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JbOF7-0008Ca-49 for guile-devel@m.gmane.org; Mon, 17 Mar 2008 18:55:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JbOF3-0008CU-Tc for guile-devel@gnu.org; Mon, 17 Mar 2008 18:55:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JbOF1-0008CI-Ao for guile-devel@gnu.org; Mon, 17 Mar 2008 18:55:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JbOF1-0008CF-6u for guile-devel@gnu.org; Mon, 17 Mar 2008 18:55:39 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JbOEw-0000hI-Ru; Mon, 17 Mar 2008 18:55:35 -0400 Original-Received: from arudy (host86-145-183-175.range86-145.btcentralplus.com [86.145.183.175]) by mail3.uklinux.net (Postfix) with ESMTP id 927A61F67F5; Mon, 17 Mar 2008 22:55:33 +0000 (GMT) Original-Received: from laruns (laruns [192.168.0.10]) by arudy (Postfix) with ESMTP id DF95D3800A; Mon, 17 Mar 2008 22:55:32 +0000 (GMT) In-Reply-To: <87wso5livc.fsf@gnu.org> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Fri, 14 Mar 2008 11:06:47 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: 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:7078 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=E8s) writes: > Hello, > > That "no duplicate" test in `popen.test' leaves a zombie behind it [0]. > The fix would be to `waitpid' the process created by `open-input-pipe' > (see attached patch), but that makes it hang, waiting for "sleep 999" to > complete. I've attached an alternative possible solution, using feedback from the parent to the child to avoid needing the long sleep. Unfortunately, though, I didn't manage to observe the zombie process with the test as it was before. (How do I do this on GNU/Linux?) So I don't really know whether this is a significant improvement. > I'm not sure whether it's an indication that the bug was caught, or > rather an indication that the test is broken, especially since I don't > fully understand the bug that it's trying to catch. If waitpid fixes it, doesn't that point to the test being broken? > I would appreciate feedback on this since it's tempting to remove it > altogether for all the harm it's done. ;-) It seems a worthwhile test to me. I'd rather work on a tricky test like this, than on a report of a problem in the context of a whole application (but which eventually boiled down to the same thing). I'm also interested in the forking/threads issue (which is now fixed, if I've understood the cited thread correctly), and wouldn't want to remove a test that covered that, unless we can devise a more specific test for just that issue. Regards, Neil --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=popen.diff Index: test-suite/tests/popen.test =================================================================== RCS file: /cvsroot/guile/guile/guile-core/test-suite/tests/popen.test,v retrieving revision 1.3.2.2 diff -u -r1.3.2.2 popen.test --- test-suite/tests/popen.test 25 Aug 2006 01:21:39 -0000 1.3.2.2 +++ test-suite/tests/popen.test 17 Mar 2008 22:54:07 -0000 @@ -81,12 +81,15 @@ (let* ((pair (pipe)) (port (with-error-to-port (cdr pair) (lambda () - (open-input-pipe - "exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; sleep 999"))))) + (open-input-output-pipe + "exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; read"))))) (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)))))) + (let ((result (and (char? (read-char (car pair))) ;; wait for child to do its thing + (char-ready? port) + (eof-object? (read-char port))))) + (display "hello!\n" port) + (close-pipe port) + result)))) ;; ;; open-output-pipe --=-=-=--