Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fork/pipe on windows

0 views
Skip to first unread message

Uri Guttman

unread,
Nov 23, 2003, 3:24:15 AM11/23/03
to perl5-...@perl.org

i am trying to use the fork/pipe examples at the end of perlfork
(5.8). when i run the pipe_to_fork example it works. the pipe_from_fork
just hangs.


in the docs for open there is coverage of open(FILEHANDLE, "<&=$fd")
(which is used in pipe_to_fork)

but there in no mention of the other direction which would be
open(FILEHANDLE, ">&=$fd") which is used in pipe_from_fork.

so there is either a bug in open in not supporting
open(FILEHANDLE, ">&=$fd") or in the perlfork doc for mentioning it and
showing a broken example.

any ideas or answers?

thanx,

uri

--
Uri Guttman ------ u...@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org

Uri Guttman

unread,
Dec 8, 2003, 3:11:24 AM12/8/03
to perl5-...@perl.org

no one responded to this post and i think it is important. there is
either a bug in fork for winblows or a bug in the docs. the example
shown in perlfork does not work on windows. i worked around it by using
socketpair and that is fine but still someone should verify what i found
and hopefully something can be done to fix it.

thanx,

uri

>>>>> "UG" == Uri Guttman <u...@stemsystems.com> writes:

UG> i am trying to use the fork/pipe examples at the end of perlfork
UG> (5.8). when i run the pipe_to_fork example it works. the pipe_from_fork
UG> just hangs.


UG> in the docs for open there is coverage of open(FILEHANDLE, "<&=$fd")
UG> (which is used in pipe_to_fork)

UG> but there in no mention of the other direction which would be
UG> open(FILEHANDLE, ">&=$fd") which is used in pipe_from_fork.

UG> so there is either a bug in open in not supporting
UG> open(FILEHANDLE, ">&=$fd") or in the perlfork doc for mentioning it and
UG> showing a broken example.

UG> any ideas or answers?

Nick Ing-Simmons

unread,
Dec 8, 2003, 3:58:36 AM12/8/03
to u...@stemsystems.com, perl5-...@perl.org
Uri Guttman <u...@stemsystems.com> writes:
>no one responded to this post

Only the ActiveState crowd _really_ understand the windows port,
and they don't always watch here.

>and i think it is important.

Lots of stuff on Windows doesn't work as POSIX.

>there is
>either a bug in fork for winblows or a bug in the docs. the example
>shown in perlfork does not work on windows.

Patches (even doc patches that say this doesn't work on windows) welcome.
Also welcome is a complete script which when run on Windows prints
"not ok"
and when run on POSIX prints "ok".

There are several things that could be wrong
- psuedo fork juggling fds in the parent/child "thread"
- Win32 PIPE semantics not being same
- trying to use select() on a pipe (doomed...)

Uri Guttman

unread,
Dec 8, 2003, 11:22:09 AM12/8/03
to Nick Ing-Simmons, perl5-...@perl.org
>>>>> "NI" == Nick Ing-Simmons <nick.ing...@elixent.com> writes:

NI> Uri Guttman <u...@stemsystems.com> writes:
>> no one responded to this post

NI> Only the ActiveState crowd _really_ understand the windows port,
NI> and they don't always watch here.

i expected it was an activestate thing but i don't know how to get their
attention to it.

>> and i think it is important.

NI> Lots of stuff on Windows doesn't work as POSIX.

oh, i know that and i worked hard to get this test going on winblows. i
even acquired a new xp box so i could properly test and debug
stuff. asking people to do it remotely for my code was not very
effective.


NI> Patches (even doc patches that say this doesn't work on windows) welcome.
NI> Also welcome is a complete script which when run on Windows prints
NI> "not ok"
NI> and when run on POSIX prints "ok".

i won't patch it until i know for sure that it is a doc bug vs a
internals bug. maybe the open should work on winblows but wasn't
properly done. also that is not a POSIX feature afaik but a winblows
hack to get around open -| and |- not being supported. this whole
section in perlfork is just winblows related.

NI> There are several things that could be wrong
NI> - psuedo fork juggling fds in the parent/child "thread"
NI> - Win32 PIPE semantics not being same
NI> - trying to use select() on a pipe (doomed...)

select on pipes does work there in the other direction and with
socketpair. this appears to be a bug in the reopen call in the example.

thanx,

uri

Nick Ing-Simmons

unread,
Dec 8, 2003, 12:35:44 PM12/8/03
to u...@stemsystems.com, Nick Ing-Simmons, perl5-...@perl.org
Uri Guttman <u...@stemsystems.com> writes:
> NI> - trying to use select() on a pipe (doomed...)
>
>select on pipes does work there in the other direction

select() from WinSock ONLY WORKS FOR SOCKETS (and only sockets opened
in synchronous mode). There is a mountain of code in Tcl_Channel that
juggles modes - my dire warnings are from the spirit of comments there.

So if it works "the other way" it is by luck.

>and with
>socketpair.

Yes.


0 new messages