From: Neil Jerram <neil@ossau.uklinux.net>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: "no duplicate" in `popen.test'
Date: Mon, 17 Mar 2008 22:55:32 +0000 [thread overview]
Message-ID: <87od9dc657.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87wso5livc.fsf@gnu.org> (Ludovic Courtès's message of "Fri, 14 Mar 2008 11:06:47 +0100")
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
ludo@gnu.org (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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: popen.diff --]
[-- Type: text/x-diff, Size: 1105 bytes --]
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
next prev parent reply other threads:[~2008-03-17 22:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-14 10:06 "no duplicate" in `popen.test' Ludovic Courtès
2008-03-17 22:55 ` Neil Jerram [this message]
2008-03-18 21:13 ` Ludovic Courtès
2008-05-19 8:53 ` Ludovic Courtès
2008-06-09 20:48 ` Neil Jerram
2009-05-19 23:56 ` Neil Jerram
2009-05-20 11:39 ` Ludovic Courtès
2009-05-20 17:44 ` Neil Jerram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87od9dc657.fsf@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).