Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 31557
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: GAISSMAI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.9999
Fixed in: (no value)



Subject: POE::Wheel::Run, IO::Pty and controlling terminal
POE::Wheel::Run with conduit set to 'pty' can't set the pty slave as controlling terminal. See code snippet from POE::Wheel::Run::new <<<<<<<<<<<<<<<<<<<<<< snip >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # Acquire a controlling terminal. Program 19.3, APITUE. if (defined TIOCSCTTY and not defined CIBAUD) { ioctl( $stdin_read, TIOCSCTTY, 0 ); } <<<<<<<<<<<<<<<<<<<<<< snap >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> isn't executed since the CIBAUD from IO::Tty::Constant::CIBAUD is mostly defined. I think you should use the method: IO::Pty::make_slave_controlling_terminal to perform this. This helper method exists since IO-Tty-1.02. Please refactor also the code for raw and windowsize since there exists also helper methods in IO::Pty/Tty: IO::Pty::set_raw() and IO::Pty::clone_winsize_from(\*FH) Best Regard and many thanks for POE!
From: GAISSMAI [...] cpan.org
On Sa. 15. Dez. 2007, 04:34:24, GAISSMAI wrote: Show quoted text
> POE::Wheel::Run with conduit set to 'pty' can't set the pty slave as > controlling terminal.
a test case is attached
#!/usr/bin/perl -w # $Id$ use strict; use Test::More; BEGIN { eval { use IO::Pty }; if ($@) { plan skip_all => 'IO::Pty is required for this test'; } else { # hack to enable controlling terminal in POE::Wheel::Run # # no warnings; # undef &IO::Tty::Constant::CIBAUD; } } # Delayed loading in order to get a chance to undefine # &IO::Tty::Constant::CIBAUD # used in POE::Wheel::Run::BEGIN{} block # see above the commented else clause. # use POE qw(Wheel::Run); plan tests => 1; POE::Session->create( inline_states => { _start => \&start_wheel, stdout => \&handle_stdout, sigchld => \&reaper }, ); POE::Kernel->run(); exit; sub start_wheel { my ( $kernel, $heap, ) = @_[ KERNEL, HEAP, ]; $kernel->sig( CHLD => 'sigchld' ); my $wheel = POE::Wheel::Run->new( Program => $^X, ProgramArgs => [ '-e', q('open TTY, "+< /dev/tty" or die "/dev/tty: $!\n"'), ], Conduit => 'pty', StdoutEvent => 'stdout', ); $heap->{wheel} = $wheel; } sub handle_stdout { my ( $kernel, $heap, $output ) = @_[ KERNEL, HEAP, ARG0, ]; $heap->{stdout} = $output; } sub reaper { my ( $kernel, $heap, $child_error ) = @_[ KERNEL, HEAP, ARG2, ]; $kernel->sig( CHLD => undef ); $kernel->sig_handled; ok( $child_error == 0, 'open /dev/tty' ); diag( $heap->{stdout} ) if $child_error != 0 && $heap->{stdout}; delete $heap->{wheel}; }
I've committed the IO::Pty helpers to POE::Wheel::Run in revision 2283. I wasn't able to use your test case. I couldn't get the test to fail.
Subject: Re: [rt.cpan.org #31557] POE::Wheel::Run, IO::Pty and controlling terminal
Date: Mon, 10 Mar 2008 14:17:47 +0100
To: bug-POE [...] rt.cpan.org
From: Karl Gaissmaier <karl.gaissmaier [...] uni-ulm.de>
RCAPUTO via RT schrieb: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=31557 > > > I've committed the IO::Pty helpers to POE::Wheel::Run in revision 2283.
thanks a lot! The code is now simpler to maintain, hopefully. Show quoted text
> I wasn't able to use your test case. I couldn't get the test to fail.
hm, perhaps it depends on your OS Version. See my test output: A freshly retrieved POE from POE Show quoted text
> corona$ pwd > /users/foo/.cpan/build/POE-0.9999
Test output from my test added to the test cases Show quoted text
> corona$ prove t/90_regression/rt31557-gaissmai-tty.t > t/90_regression/rt31557-gaissmai-tty.... > # Failed test 'open /dev/tty' > # at t/90_regression/rt31557-gaissmai-tty.t line 65. > t/90_regression/rt31557-gaissmai-tty....NOK 1/1# /dev/tty: No such device or address > # Looks like you failed 1 test of 1. > t/90_regression/rt31557-gaissmai-tty....dubious > Test returned status 1 (wstat 256, 0x100) > DIED. FAILED test 1 > Failed 1/1 tests, 0.00% okay > Failed Test Stat Wstat Total Fail List of Failed > ------------------------------------------------------------------------------- > t/90_regression/rt31557-gaissmai-tty.t 1 256 1 1 1 > Failed 1/1 test scripts. 1/1 subtests failed. > Files=1, Tests=1, 3 wallclock secs ( 0.29 cusr + 0.22 csys = 0.51 CPU) > Failed 1/1 test programs. 1/1 subtests failed.
the used perl Version Show quoted text
> corona$ perl -V > Summary of my perl5 (revision 5 version 8 subversion 8) configuration: > Platform: > osname=solaris, osvers=2.10, archname=sun4-solaris > uname='sunos flare 5.10 generic_118833-18 sun4u sparc sunw,sun-fire-v240 solaris ' > config_args='-des -Dprefix=/soft/local -Dcf_email=hostadm@uni-ulm.de -Dlocincpth=/soft/local/include -Dloclibpth=/soft/local/lib -Dstartperl=#! /usr/local/bin/perl -Dman3dir=/soft/local/man/man3' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='/opt/SUNWspro/bin/cc', ccflags ='-I/soft/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV', > optimize='-O', > cppflags='-I/soft/local/include' > ccversion='Sun C 5.8 Patch 121015-02 2006/03/29', gccversion='', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='/opt/SUNWspro/bin/cc', ldflags =' -L/usr/lib -L/usr/ccs/lib -L/opt/SUNWspro/prod/lib/v8plus -L/opt/SUNWspro/prod/lib -L/lib -L/soft/local/lib ' > libpth=/usr/lib /usr/ccs/lib /opt/SUNWspro/prod/lib/v8plus /opt/SUNWspro/prod/lib /lib /soft/local/lib /usr/local/lib > libs=-lsocket -lnsl -lgdbm -ldl -lm -lc > perllibs=-lsocket -lnsl -ldl -lm -lc > libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='' > cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib -L/opt/SUNWspro/prod/lib/v8plus -L/opt/SUNWspro/prod/lib -L/lib -L/soft/local/lib' > > > Characteristics of this binary (from libperl): > Compile-time options: PERL_MALLOC_WRAP PERL_USE_SAFE_PUTENV > USE_LARGE_FILES USE_PERLIO > Built under solaris > Compiled at Sep 29 2006 14:26:12 > %ENV: > PERL5LIB="/users/urz1/gaissmai/local/perl/lib:/users/urz1/gaissmai/local/perl/lib/site_perl" > @INC: > /users/urz1/gaissmai/local/perl/lib/sun4-solaris > /users/urz1/gaissmai/local/perl/lib > /users/urz1/gaissmai/local/perl/lib/site_perl/5.8.8 > /users/urz1/gaissmai/local/perl/lib/site_perl > /soft/local/lib/perl5/5.8.8 > /soft/local/lib/site_perl/5.8.8 > /soft/local/lib/site_perl/5.8.8 > /soft/local/lib/perl5/site_perl > .
Show quoted text
> >
Best Regards Charly
On Mon Mar 10 10:19:10 2008, karl.gaissmaier@uni-ulm.de wrote: Show quoted text
> RCAPUTO via RT schrieb:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=31557 > > > > > I've committed the IO::Pty helpers to POE::Wheel::Run in revision
> 2283. > > thanks a lot! The code is now simpler to maintain, hopefully.
Well... even complex code is easy to maintain if it works. Unfortunately, it didn't quite work. :) Show quoted text
> > I wasn't able to use your test case. I couldn't get the test to
> fail. > > hm, perhaps it depends on your OS Version. See my test output:
[Solaris] Aha! I don't have a Solaris machine to test/develop on right now, so I'm not going to be able to hunt down the platform-specific bits here.
Oh, I forgot to thank you. Thanks for recommending the fix, and I'm sorry I couldn't use your test case. Your fix was applied over 380 revisions ago, and nothing (related!) broke since then. Despite the lack of a test case, I'd call that success.