Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3

by shadowsong (Pilgrim)
on Mar 22, 2016 at 15:17 UTC ( [id://1158508]=note: print w/replies, xml ) Need Help??


in reply to Re: Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3
in thread Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3

BrowserUk,

Thank you very much indeed.

I was able to use fileno to output the integer value associated with STDOUT just prior to the open call [as well as just prior to the subroutine call which contains said open call]

modified Builder.pm with diagnostic print statements

sub _dup_stdhandles { my $self = shift; print STDERR "\n\n******* [chkpt1]BrowserUk diagnostic STDOUT file +no: ",fileno(STDOUT)," *******\n\n"; $self->_open_testhandles; # Set everything to unbuffered else plain prints to STDOUT will # come out in the wrong order from our own prints. _autoflush($Testout); _autoflush( \*STDOUT ); _autoflush($Testerr); _autoflush( \*STDERR ); $self->reset_outputs; return; } sub _open_testhandles { my $self = shift; return if $self->{Opened_Testhandles}; print STDERR "\n\n******* [chkpt2]BrowserUk diagnostic STDOUT file +no: ",fileno(STDOUT)," *******\n\n"; # We dup STDOUT and STDERR so people can change them in their # test suites while still getting normal test output. open( $Testout, ">&STDOUT" ) or die "Can't dup STDOUT: $!"; open( $Testerr, ">&STDERR" ) or die "Can't dup STDERR: $!"; $self->_copy_io_layers( \*STDOUT, $Testout ); $self->_copy_io_layers( \*STDERR, $Testerr ); $self->{Opened_Testhandles} = 1; return; }

installation attempt which triggers the diagnostic print

>cpan Path::Tiny Reading 'C:\Users\jndt\.cpan\Metadata' Database was generated on Tue, 22 Mar 2016 13:53:38 GMT Running install for module 'Path::Tiny' Checksum for C:\Users\jndt\.cpan\sources\authors\id\D\DA\DAGOLDEN\Path +-Tiny-0.084.tar.gz ok 'YAML' not installed, will not store persistent state Configuring D/DA/DAGOLDEN/Path-Tiny-0.084.tar.gz with Makefile.PL Checking if your kit is complete... Looks good Generating a nmake-style Makefile Writing Makefile for Path::Tiny Writing MYMETA.yml and MYMETA.json DAGOLDEN/Path-Tiny-0.084.tar.gz C:\perl-5.20.3\bin\perl.exe Makefile.PL -- OK Running make for D/DA/DAGOLDEN/Path-Tiny-0.084.tar.gz ---- Unsatisfied dependencies detected during ---- ---- DAGOLDEN/Path-Tiny-0.084.tar.gz ---- Unicode::UTF8 [requires,optional] Test::MockRandom [build_requires,optional] Test::FailWarnings [build_requires,optional] Microsoft (R) Program Maintenance Utility Version 14.00.23824.1 Copyright (C) Microsoft Corporation. All rights reserved. cp lib/Path/Tiny.pm blib\lib\Path\Tiny.pm DAGOLDEN/Path-Tiny-0.084.tar.gz "C:\Program Files\Microsoft Visual Studio 14.0\VC\BIN\nmake.EXE" -- +OK Running make test Microsoft (R) Program Maintenance Utility Version 14.00.23824.1 Copyright (C) Microsoft Corporation. All rights reserved. C:\perl-5.20.3\bin\perl.exe "-MExtUtils::Command::MM" "-MTest: +:Harness" "-e" "undef *Test::Harness::Switches; test_harness(0 , 'blib\lib', 'blib\arch')" t/*.t t/00-report-prereqs.t ............. ******* [chkpt1]BrowserUk diagnostic STDOUT fileno: 1 ******* ******* [chkpt2]BrowserUk diagnostic STDOUT fileno: 1 ******* Can't dup STDOUT: Bad file descriptor at C:/perl-5.20.3/lib/Test/Buil +der.pm line 1952. Compilation failed in require at C:/perl-5.20.3/lib/Test/Builder/Modul +e.pm line 5. BEGIN failed--compilation aborted at C:/perl-5.20.3/lib/Test/Builder/M +odule.pm line 5. Compilation failed in require at C:/perl-5.20.3/lib/Test/More.pm line +23. BEGIN failed--compilation aborted at C:/perl-5.20.3/lib/Test/More.pm l +ine 23. Compilation failed in require at t/00-report-prereqs.t line 8. BEGIN failed--compilation aborted at t/00-report-prereqs.t line 8. t/00-report-prereqs.t ............. Dubious, test returned 9 (wstat 23 +04, 0x900) No subtests run t/basename.t ...................... ******* [chkpt1]BrowserUk diagnostic STDOUT fileno: 1 ******* ******* [chkpt2]BrowserUk diagnostic STDOUT fileno: 1 ******* ...

observations

  • The STDOUT file descriptor is associated with 1
  • Notice the diagnostic print is sent to STDERR? This is because attempts to send it to STDOUT resulted in nothing being displayed…
  • I have built this on a 64bit Win10 system with VC2015 RC2 without encountering this issue
  • I rebuilt perl-5.20.3 on this system using VC2015 RC2 (just to be certain I used the same tools that yielded a successful build)

So, although the STDOUT is 1 - the fact that printing to it yields no output; signifies something is definitely wrong with it.

Thanks again for your help - I feel much better about it now and I learned a new function.

Cheers,
Shadowsong

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1158508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found