cpan-authors / IPC-Run

https://metacpan.org/pod/IPC::Run
Other
21 stars 38 forks source link

pty tests fail on Fedora29 #130

Closed DannyThomas closed 4 years ago

DannyThomas commented 6 years ago

possibly related to #56 probably not specific to Fedora29 probably not specific to perl-5.29.4

NB http://www.cpantesters.org/cpan/report/4549bd4e-c71d-11e8-bca8-6f605ebbffd9 Fedora28 is green but "t/pty.t .............................. skipped: IO::Pty not installed"

I don't know much about cpantesters, but shouldn't required modules be installed before distribution built/tested?

IPC-Run-20180523.0 Readonly-2.05 Test-Simple-1.302140 (for Test::More)

For now, I'm disabling t/pty.t because IPR-Run is a dependency in several subsequent distributions I build

t/pty.t .............................. # IO::Tty 1.12, IO::Pty 1.12
t/pty.t .............................. 1/32 
#   Failed test at t/pty.t line 136.
#          got: '012-456789--'
#     expected: '012--5678---'
# Looks like you failed 1 test of 32.
t/pty.t .............................. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/32 subtests 

as a separate issue, should these tests be run on non-Win host?

t/win32_compile.t .................... ok   
t/windows_search_path.t .............. ok     
toddr commented 5 years ago

The issue is with IO::Pty. On Red Hat 7, I get:

$>perl -MIO::Pty -MIPC::Run::Debug -wE'print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";my $h = IO::Pty->new; print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";undef $h; print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";'
-e 1  012---------
-e 1  01234-------
-e 1  012---------

But on RedHat 8, I get:

$>perl -MIO::Pty -MIPC::Run::Debug -wE'print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";my $h = IO::Pty->new; print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";undef $h; print __FILE__ . " " . __LINE__ . "  " . IPC::Run::Debug::_map_fds() . "\n";'
-e 1  012---------
-e 1  012345------
-e 1  012-4-------

When the IO::Pty object goes out of scope, one of the file handles is not closing for some reason.

toddr commented 5 years ago

https://rt.cpan.org/Ticket/Display.html?id=130491

eserte commented 4 years ago

Running the test with strace shows the following difference (both runs with perl 5.30.1):

eserte commented 4 years ago

... and lsof right before the failing test shows this additional open file descriptor on the failing system:

perl5.30. 14546 cpansand    4r   REG    8,1  6406312   144033 /var/lib/sss/mc/group

On the passing Fedora system this file does not exist (so it cannot be opened).

eserte commented 4 years ago

A combination of perl -d:Trace and strace shows that /var/lib/sss/mc/group is opened during this call:

/opt/perl-5.30.1/lib/site_perl/5.30.1/x86_64-linux/IO/Pty.pm:24:   my ($ptyfd, $ttyfd, $ttyname) = pty_allocate();

So, possible workarounds:

eserte commented 4 years ago

First alternative could look like this: http://cpan.cpantesters.org/authors/id/S/SR/SREZIC/patches/IPC-Run-20180523.0-issue130.patch But now I think it would be a little bit cleaner if the dummy pty creation was done earlier, before the first SKIP. Theoretically sssd exists also for some *BSD systems listed for $platform_skip

toddr commented 4 years ago

I’m happy to fix the test, but do you think this might indicate a problem that we should be fixing in the code?

kloczek commented 4 years ago

@eserte

First alternative could look like this: http://cpan.cpantesters.org/authors/id/S/SR/SREZIC/patches/IPC-Run-20180523.0-issue130.patch

I've tested that patch on rawhide and looks like test suite passes correctly.

+ cd IPC-Run-20180523.0
+ /usr/bin/make -O -j48 V=1 VERBOSE=1 test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/97_meta.t .......................... skipped: Author tests not required for installation
t/98_pod.t ........................... skipped: Author tests not required for installation
t/98_pod_coverage.t .................. skipped: Author tests not required for installation
t/99_perl_minimum_version.t .......... skipped: Author tests not required for installation
t/adopt.t ............................ skipped: adopt not implemented yet
t/autoflush.t ........................ ok
t/binmode.t .......................... ok
t/bogus.t ............................ ok
t/eintr.t ............................ ok
t/filter.t ........................... ok
t/harness.t .......................... ok
t/io.t ............................... ok
t/kill_kill.t ........................ ok
t/parallel.t ......................... ok
# IO::Tty 1.14, IO::Pty 1.14
t/pty.t .............................. ok
t/pump.t ............................. ok
t/readonly.t ......................... ok
t/run.t .............................. ok
t/run_stdin-callback-return-array.t .. ok
t/signal.t ........................... ok
t/timeout.t .......................... ok
t/timer.t ............................ ok
t/utf8.t ............................. ok
t/windows_search_path.t .............. ok
All tests successful.
Files=24, Tests=721, 16 wallclock secs ( 0.21 usr  0.15 sys +  1.98 cusr  1.99 csys =  4.33 CPU)
kloczek commented 4 years ago

BTW: do you have any plans to make new release? :)

toddr commented 4 years ago

https://metacpan.org/release/TODDR/IPC-Run-20200505.0