[EMAIL PROTECTED] (Ludovic Courtès) 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

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

Reply via email to