[comp.lang.perl] Problem opening pty/tty with perl

rrr@u02.svl.cdc.com (Rich Ragan) (11/14/90)

I have a Perl script that uses pty/tty to communicate with
another task. This all worked fine at patch level 28.
I upgraded to patch level 37 (and also tried 40 as well)
and found that the following (subsetted) part of the script
shows the problem:

open($pty,"+>/dev/ptyp1")|| die "cant open pty\n";
print "First open OK\n";
open($tty,"+</dev/ttyp1")|| die "cant open tty\n";
print "Second open OK\n";
close($pty); close($tty);

With PL28, this all works fine. Both open's complete.
With PL37 and PL40, the script always hangs on the
second open. The more general code is actually trying
all pty/tty pairs looking for a free one so the
problem should not be the hardwired pty/tty name.
Any ideas what might be going wrong?

By the way, PL40 fails on the last of the tests for
me as well (Mips RISC/OS based system).
Thanks.
--
Richard R. Ragan  rrr@svl.cdc.com  (408) 496-4340 
Control Data Corporation--Silicon Valley Operations

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (11/14/90)

In article <28619@shamash.cdc.com> rrr@svl.cdc.com writes:
: I have a Perl script that uses pty/tty to communicate with
: another task. This all worked fine at patch level 28.
: I upgraded to patch level 37 (and also tried 40 as well)
: and found that the following (subsetted) part of the script
: shows the problem:
: 
: open($pty,"+>/dev/ptyp1")|| die "cant open pty\n";
: print "First open OK\n";
: open($tty,"+</dev/ttyp1")|| die "cant open tty\n";
: print "Second open OK\n";
: close($pty); close($tty);
: 
: With PL28, this all works fine. Both open's complete.
: With PL37 and PL40, the script always hangs on the
: second open. The more general code is actually trying
: all pty/tty pairs looking for a free one so the
: problem should not be the hardwired pty/tty name.
: Any ideas what might be going wrong?

I suspect you aren't setting $pty and $tty to different values.  I can
reproduce the hanging behavior by making them the same.  Remember that
$pty and $tty are not filehandles, they *hold* filehandles.

: By the way, PL40 fails on the last of the tests for
: me as well (Mips RISC/OS based system).

That will (hopefully) be fixed in the next patch, which should be out today.

By the way, does anyone have a compiled copy of groff for Sun3 or Sun4 (4.1)
or even Vax or Pyramid?  I've spent hours trying to get it to compile and
run, and don't have any more time to piddle with it.  It would make me
Very Happy if there was somewhere I could ftp a runnable copy.  You'll
never guess what I want to groff a copy of...

Larry