Closed DannyThomas closed 4 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.
Running the test with strace shows the following difference (both runs with perl 5.30.1):
42484 12:12:06.747088 dup(0) = 3 <0.000005>
42484 12:12:06.747113 close(3) = 0 <0.000013>
42484 12:12:06.747146 dup(1) = 3 <0.000005>
42484 12:12:06.747165 close(3) = 0 <0.000005>
42484 12:12:06.747185 dup(2) = 3 <0.000005>
42484 12:12:06.747203 close(3) = 0 <0.000005>
42484 12:12:06.747222 dup(3) = -1 EBADF (Bad file descriptor) <0.000005>
42484 12:12:06.747245 dup(4) = -1 EBADF (Bad file descriptor) <0.000005>
42484 12:12:06.747265 dup(5) = 3 <0.000005>
42484 12:12:06.747284 close(3) = 0 <0.000005>
42484 12:12:06.747303 dup(6) = 3 <0.000005>
42484 12:12:06.747321 close(3) = 0 <0.000005>
42484 12:12:06.747340 dup(7) = 3 <0.000005>
42484 12:12:06.747360 close(3) = 0 <0.000005>
42484 12:12:06.747379 dup(8) = 3 <0.000005>
42484 12:12:06.747397 close(3) = 0 <0.000005>
42484 12:12:06.747416 dup(9) = -1 EBADF (Bad file descriptor) <0.000005>
13882 12:10:15.705938 dup(0) = 3 <0.000006>
13882 12:10:15.705969 close(3) = 0 <0.000005>
13882 12:10:15.705997 dup(1) = 3 <0.000005>
13882 12:10:15.706020 close(3) = 0 <0.000005>
13882 12:10:15.706045 dup(2) = 3 <0.000007>
13882 12:10:15.706078 close(3) = 0 <0.000007>
13882 12:10:15.706111 dup(3) = -1 EBADF (Bad file descriptor) <0.000007>
13882 12:10:15.706149 dup(4) = 3 <0.000005>
13882 12:10:15.706176 close(3) = 0 <0.000008>
13882 12:10:15.706211 dup(5) = 3 <0.000007>
13882 12:10:15.706242 close(3) = 0 <0.000005>
13882 12:10:15.706266 dup(6) = 3 <0.000005>
13882 12:10:15.706305 close(3) = 0 <0.000005>
13882 12:10:15.706331 dup(7) = 3 <0.000005>
13882 12:10:15.706354 close(3) = 0 <0.000005>
13882 12:10:15.706400 dup(8) = 3 <0.000005>
13882 12:10:15.706430 close(3) = 0 <0.000005>
13882 12:10:15.706454 dup(9) = -1 EBADF (Bad file descriptor) <0.000005>
... 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).
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:
IO::Pty
object before calling _map_fds
e.g. like this:
{my $pty = IO::Pty->new}
This would force a pty_allocate
call which would open the group sss file early.
getgrnam($();
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
I’m happy to fix the test, but do you think this might indicate a problem that we should be fixing in the code?
@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)
BTW: do you have any plans to make new release? :)
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
as a separate issue, should these tests be run on non-Win host?