dagolden / Capture-Tiny

(Perl) Capture STDOUT and STDERR from Perl, XS or external programs
http://search.cpan.org/dist/Capture-Tiny/
39 stars 19 forks source link

Capture::Tiny fails a lot of tests on Windows 8.1 with perl 5.21.7 #26

Closed nanis closed 9 years ago

nanis commented 9 years ago

I am not able to make heads or tails out of this. If you can tell me what to look for, I can work on diagnosing whether the underlying problem is a bug with my build, or something else.

This may or may not be related to https://github.com/dagolden/Capture-Tiny/issues/23

Details below, but the typical failing message is this:

#   Failed test 'tee_merged|perl|both|short - tee STDERR'
#   at t/lib/Cases.pm line 22.
#          got: 'Warning: unable to close filehandle GEN1328 properly: Bad file descriptor at t/lib/Cases.pm line 235, <$fh> line 1.
# Warning: unable to close filehandle GEN1326 properly: Bad file descriptor at t/lib/Cases.pm line 235, <$fh> line 1.
# '
#     expected: ''

Test Summary Report
-------------------
t\03-tee.t               (Wstat: 38400 Tests: 541 Failed: 150)
  Failed tests:  4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44
                48, 52, 56, 60, 64, 68, 72, 76, 80, 84
                88, 92, 96, 100, 104, 108, 112, 116, 120
                123, 126, 129, 132, 135, 138, 141, 144
                147, 150, 153, 156, 159, 162, 165, 168
                171, 174, 177, 180, 183, 186, 189, 192
                195, 198, 201, 204, 207, 210, 213, 216
                219, 222, 225, 228, 231, 234, 237, 240
                243, 246, 249, 252, 255, 258, 261, 264
                267, 270, 273, 276, 279, 282, 285, 288
                291, 294, 297, 300, 303, 306, 309, 312
                315, 318, 321, 324, 327, 330, 333, 336
                339, 342, 345, 348, 351, 354, 357, 360
                363, 366, 369, 372, 375, 378, 381, 384
                387, 390, 395, 400, 405, 410, 415, 420
                425, 430, 435, 440, 445, 450, 455, 460
                465, 470, 475, 480, 485, 490, 495, 500
                505, 510, 515, 520, 525, 530, 535, 540
  Non-zero exit status: 150
t\06-stdout-closed.t     (Wstat: 38400 Tests: 872 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\07-stderr-closed.t     (Wstat: 38400 Tests: 872 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\08-stdin-closed.t      (Wstat: 38400 Tests: 872 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\10-stdout-string.t     (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  336, 340, 344, 348, 352, 356, 360, 364
                368, 372, 376, 380, 384, 388, 392, 396
                400, 404, 408, 412, 416, 420, 424, 428
                432, 436, 440, 444, 448, 452, 455, 458
                461, 464, 467, 470, 473, 476, 479, 482
                485, 488, 491, 494, 497, 500, 503, 506
                509, 512, 515, 518, 521, 524, 527, 530
                533, 536, 539, 542, 545, 548, 551, 554
                557, 560, 563, 566, 569, 572, 575, 578
                581, 584, 587, 590, 593, 596, 599, 602
                605, 608, 611, 614, 617, 620, 623, 626
                629, 632, 635, 638, 641, 644, 647, 650
                653, 656, 659, 662, 665, 668, 671, 674
                677, 680, 683, 686, 689, 692, 695, 698
                701, 704, 707, 710, 713, 716, 719, 722
                727, 732, 737, 742, 747, 752, 757, 762
                767, 772, 777, 782, 787, 792, 797, 802
                807, 812, 817, 822, 827, 832, 837, 842
                847, 852, 857, 862, 867, 872
  Non-zero exit status: 150
t\11-stderr-string.t     (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  336, 340, 344, 348, 352, 356, 360, 364
                368, 372, 376, 380, 384, 388, 392, 396
                400, 404, 408, 412, 416, 420, 424, 428
                432, 436, 440, 444, 448, 452, 455, 458
                461, 464, 467, 470, 473, 476, 479, 482
                485, 488, 491, 494, 497, 500, 503, 506
                509, 512, 515, 518, 521, 524, 527, 530
                533, 536, 539, 542, 545, 548, 551, 554
                557, 560, 563, 566, 569, 572, 575, 578
                581, 584, 587, 590, 593, 596, 599, 602
                605, 608, 611, 614, 617, 620, 623, 626
                629, 632, 635, 638, 641, 644, 647, 650
                653, 656, 659, 662, 665, 668, 671, 674
                677, 680, 683, 686, 689, 692, 695, 698
                701, 704, 707, 710, 713, 716, 719, 722
                727, 732, 737, 742, 747, 752, 757, 762
                767, 772, 777, 782, 787, 792, 797, 802
                807, 812, 817, 822, 827, 832, 837, 842
                847, 852, 857, 862, 867, 872
  Non-zero exit status: 150
t\12-stdin-string.t      (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  336, 340, 344, 348, 352, 356, 360, 364
                368, 372, 376, 380, 384, 388, 392, 396
                400, 404, 408, 412, 416, 420, 424, 428
                432, 436, 440, 444, 448, 452, 455, 458
                461, 464, 467, 470, 473, 476, 479, 482
                485, 488, 491, 494, 497, 500, 503, 506
                509, 512, 515, 518, 521, 524, 527, 530
                533, 536, 539, 542, 545, 548, 551, 554
                557, 560, 563, 566, 569, 572, 575, 578
                581, 584, 587, 590, 593, 596, 599, 602
                605, 608, 611, 614, 617, 620, 623, 626
                629, 632, 635, 638, 641, 644, 647, 650
                653, 656, 659, 662, 665, 668, 671, 674
                677, 680, 683, 686, 689, 692, 695, 698
                701, 704, 707, 710, 713, 716, 719, 722
                727, 732, 737, 742, 747, 752, 757, 762
                767, 772, 777, 782, 787, 792, 797, 802
                807, 812, 817, 822, 827, 832, 837, 842
                847, 852, 857, 862, 867, 872
  Non-zero exit status: 150
t\13-stdout-tied.t       (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\14-stderr-tied.t       (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\15-stdin-tied.t        (Wstat: 38400 Tests: 873 Failed: 150)
  Failed tests:  335, 339, 343, 347, 351, 355, 359, 363
                367, 371, 375, 379, 383, 387, 391, 395
                399, 403, 407, 411, 415, 419, 423, 427
                431, 435, 439, 443, 447, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                484, 487, 490, 493, 496, 499, 502, 505
                508, 511, 514, 517, 520, 523, 526, 529
                532, 535, 538, 541, 544, 547, 550, 553
                556, 559, 562, 565, 568, 571, 574, 577
                580, 583, 586, 589, 592, 595, 598, 601
                604, 607, 610, 613, 616, 619, 622, 625
                628, 631, 634, 637, 640, 643, 646, 649
                652, 655, 658, 661, 664, 667, 670, 673
                676, 679, 682, 685, 688, 691, 694, 697
                700, 703, 706, 709, 712, 715, 718, 721
                726, 731, 736, 741, 746, 751, 756, 761
                766, 771, 776, 781, 786, 791, 796, 801
                806, 811, 816, 821, 826, 831, 836, 841
                846, 851, 856, 861, 866, 871
  Non-zero exit status: 150
t\16-catch-errors.t      (Wstat: 256 Tests: 5 Failed: 1)
  Failed test:  4
  Non-zero exit status: 1
t\20-stdout-badtie.t     (Wstat: 25600 Tests: 583 Failed: 100)
  Failed tests:  225, 229, 233, 237, 241, 245, 249, 253
                257, 261, 265, 269, 273, 277, 281, 285
                289, 293, 297, 301, 304, 307, 310, 313
                316, 319, 322, 325, 328, 331, 334, 337
                340, 343, 346, 349, 352, 355, 358, 361
                364, 367, 370, 373, 376, 379, 382, 385
                388, 391, 394, 397, 400, 403, 406, 409
                412, 415, 418, 421, 424, 427, 430, 433
                436, 439, 442, 445, 448, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                486, 491, 496, 501, 506, 511, 516, 521
                526, 531, 536, 541, 546, 551, 556, 561
                566, 571, 576, 581
  Non-zero exit status: 100
t\21-stderr-badtie.t     (Wstat: 25600 Tests: 583 Failed: 100)
  Failed tests:  225, 229, 233, 237, 241, 245, 249, 253
                257, 261, 265, 269, 273, 277, 281, 285
                289, 293, 297, 301, 304, 307, 310, 313
                316, 319, 322, 325, 328, 331, 334, 337
                340, 343, 346, 349, 352, 355, 358, 361
                364, 367, 370, 373, 376, 379, 382, 385
                388, 391, 394, 397, 400, 403, 406, 409
                412, 415, 418, 421, 424, 427, 430, 433
                436, 439, 442, 445, 448, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                486, 491, 496, 501, 506, 511, 516, 521
                526, 531, 536, 541, 546, 551, 556, 561
                566, 571, 576, 581
  Non-zero exit status: 100
t\22-stdin-badtie.t      (Wstat: 25600 Tests: 583 Failed: 100)
  Failed tests:  225, 229, 233, 237, 241, 245, 249, 253
                257, 261, 265, 269, 273, 277, 281, 285
                289, 293, 297, 301, 304, 307, 310, 313
                316, 319, 322, 325, 328, 331, 334, 337
                340, 343, 346, 349, 352, 355, 358, 361
                364, 367, 370, 373, 376, 379, 382, 385
                388, 391, 394, 397, 400, 403, 406, 409
                412, 415, 418, 421, 424, 427, 430, 433
                436, 439, 442, 445, 448, 451, 454, 457
                460, 463, 466, 469, 472, 475, 478, 481
                486, 491, 496, 501, 506, 511, 516, 521
                526, 531, 536, 541, 546, 551, 556, 561
                566, 571, 576, 581
  Non-zero exit status: 100
t\23-all-tied.t          (Wstat: 38400 Tests: 877 Failed: 150)
  Failed tests:  337, 341, 345, 349, 353, 357, 361, 365
                369, 373, 377, 381, 385, 389, 393, 397
                401, 405, 409, 413, 417, 421, 425, 429
                433, 437, 441, 445, 449, 453, 456, 459
                462, 465, 468, 471, 474, 477, 480, 483
                486, 489, 492, 495, 498, 501, 504, 507
                510, 513, 516, 519, 522, 525, 528, 531
                534, 537, 540, 543, 546, 549, 552, 555
                558, 561, 564, 567, 570, 573, 576, 579
                582, 585, 588, 591, 594, 597, 600, 603
                606, 609, 612, 615, 618, 621, 624, 627
                630, 633, 636, 639, 642, 645, 648, 651
                654, 657, 660, 663, 666, 669, 672, 675
                678, 681, 684, 687, 690, 693, 696, 699
                702, 705, 708, 711, 714, 717, 720, 723
                728, 733, 738, 743, 748, 753, 758, 763
                768, 773, 778, 783, 788, 793, 798, 803
                808, 813, 818, 823, 828, 833, 838, 843
                848, 853, 858, 863, 868, 873
  Non-zero exit status: 150
t\24-all-badtied.t       (Wstat: 25600 Tests: 587 Failed: 100)
  Failed tests:  227, 231, 235, 239, 243, 247, 251, 255
                259, 263, 267, 271, 275, 279, 283, 287
                291, 295, 299, 303, 306, 309, 312, 315
                318, 321, 324, 327, 330, 333, 336, 339
                342, 345, 348, 351, 354, 357, 360, 363
                366, 369, 372, 375, 378, 381, 384, 387
                390, 393, 396, 399, 402, 405, 408, 411
                414, 417, 420, 423, 426, 429, 432, 435
                438, 441, 444, 447, 450, 453, 456, 459
                462, 465, 468, 471, 474, 477, 480, 483
                488, 493, 498, 503, 508, 513, 518, 523
                528, 533, 538, 543, 548, 553, 558, 563
                568, 573, 578, 583
  Non-zero exit status: 100
Files=23, Tests=11996, 278 wallclock secs ( 2.28 usr +  0.16 sys =  2.44 CPU)
Result: FAIL
Failed 16/23 test programs. 2051/11996 subtests failed.
NMAKE : fatal error U1077: 'C:\opt\perl-blead\bin\perl.exe' : return code '0x64'
Stop.

Summary of my perl5 (revision 5 version 21 subversion 7) configuration:
  Derived from:
  Platform:
    osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -fp:precise -favor:INTEL64 -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DUSE_64_BIT_ALL -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS  -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO',
    optimize='-O1 -MD -Zi -DNDEBUG -GL -fp:precise -favor:INTEL64',
    cppflags='-DWIN32'
    ccversion='18.00.31101', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=0
    ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"c:\opt\perl-blead\lib\CORE"  -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
    libpth="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64"
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"c:\opt\perl-blead\lib\CORE"  -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
                        PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
                        PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE
                        PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO
                        USE_PERL_ATOF USE_SITECUSTOMIZE
  Locally applied patches:
        uncommitted-changes
  Built under MSWin32
  Compiled at Dec  8 2014 17:38:36
  %ENV:
    PERLDOC_PAGER="c:\opt\cygwin64\bin\less.exe -+C -E -F -g -i"
  @INC:
    c:/opt/perl-blead/site/lib/MSWin32-x64-multi-thread
    c:/opt/perl-blead/site/lib
    c:/opt/perl-blead/lib
    .
dagolden commented 9 years ago

Thanks. I haven't looked at this under blead lately. "Unable to close filehandle GEN1328" makes me think there's a file descriptor leak going on. What are the "uncommitted changes" listed under "Locally applied patches" in the "perl -V" output?

And just to confirm this was hand-built with MSVC 2012, right?

Sometime in the next month or so, I have to set up a windows build box for work with Strawberry and ActiveState and several MSVC compilers, so I should have a much better test environment.

If you want to dig deeper, uncomment the debug set up code in lines 51-56, then uncomment every line that starts # _debug(...) and run just t/03-tee.t with PERL_CAPTURE_TINY_DEBUG=1. Until 03-tee.t isn't passing, trying the rest doesn't make sense.

nanis commented 9 years ago

The uncommitted changes are just my changes to win32/Makefile ... Install location, MSVC directories. This is hand-built using VS 2013, i.e. CCTYPE = MSVC120.

I will dig deeper when I can, but it probably won't be for a couple of days. Thanks for the pointer.

nanis commented 9 years ago

All the calls to _debug are also commented out. I ran after enabling them, got a half megabyte trace file. I am not sure how useful it is, I'll take a look when I can.

dagolden commented 9 years ago

If you can email it to me, I'll look it over and see what jumps out.

On Tue, Dec 9, 2014 at 2:48 PM, A. Sinan Unur notifications@github.com wrote:

All the calls to _debug are also commented out. I ran after enabling them, got a half megabyte trace file. I am not sure how useful it is, I'll take a look when I can.

— Reply to this email directly or view it on GitHub https://github.com/dagolden/Capture-Tiny/issues/26#issuecomment-66345373 .

David Golden xdg@xdg.me Twitter/IRC: @xdg

nanis commented 9 years ago

Will do. I did not want to just dump that much output on you out of the blue. Thanks.

nanis commented 9 years ago

OK, so 5.21.7 added a new warning:

Warning: unable to close filehandle %s properly: %s

I think this is the commit.

So, it is quite possible that the failure to close those handles properly existed in all versions, but only became noticeable after this commit.

The "Bad file descriptor" error message from $! is the only clue we have for now.

Just FYI.

So, one possibility is to strip the warning message when comparing stuff (hack, but allows things to go on while the issue is investigated).

I didn't see a way to turn the warning of using no warnings 'improper_close' or something like that.

dagolden commented 9 years ago

Thank you for finding that. That gives me a starting point. On Dec 21, 2014 6:47 AM, "A. Sinan Unur" notifications@github.com wrote:

OK, so 5.21.7 https://metacpan.org/pod/release/CORION/perl-5.21.7/pod/perl5216delta.pod#New-Warnings added a new warning:

Warning: unable to close filehandle %s properly: %s

I think this is the commit http://perl5.git.perl.org/perl.git/commit/96d7c88819733eaaba892177a967d9e898b2b924?f=doio.c .

So, it is quite possible that the failure to close those handles properly existed in all versions, but only became noticeable after this commit.

The "Bad file descriptor" error message from $! is the only clue we have for now.

Just FYI.

So, one possibility is to strip the warning message when comparing stuff (hack, but allows things to go on while the issue is investigated).

I didn't see a way to turn the warning of using no warnings 'improper_close' or something like that.

— Reply to this email directly or view it on GitHub https://github.com/dagolden/Capture-Tiny/issues/26#issuecomment-67767913 .

bulk88 commented 9 years ago

I also see this on Perl 5.21.8/blead.

mattn commented 9 years ago

FYI, I can't reproduce this on 5.20.0

mattn commented 9 years ago

I tried this on master/HEAD on https://github.com/perl/perl5. But can't reproduce.

nanis commented 9 years ago

@mattn Care to give some more information about your build tools, environment, platform etc?

nanis commented 9 years ago

So, I checked out blead and tried again:

Summary of my perl5 (revision 5 version 21 subversion 11) configuration:
  Derived from: 
  Platform:
    osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -O1 -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE  -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS',
    optimize='-O1 -favor:INTEL64 -MD -Zi -DNDEBUG -GL -fp:precise',
    cppflags='-DWIN32'
    ccversion='18.00.31101', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, longdblkind=0
    ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"c:\opt\perl-blead\lib\CORE"  -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
    libpth="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64" C:\opt\lib
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"c:\opt\perl-blead\lib\CORE"  -machine:AMD64 "/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'"'
Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
                        PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
                        PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE
                        PERL_PRESERVE_IVUV USE_64_BIT_INT USE_ITHREADS
                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
                        USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE
  Locally applied patches:
    uncommitted-changes
  Built under MSWin32
  Compiled at Apr 17 2015 10:14:09
  %ENV:
    PERLDOC_PAGER="c:\opt\cygwin64\bin\less.exe -+C -E -F -g -i"
  @INC:
    c:/opt/perl-blead/site/lib/MSWin32-x64-multi-thread
    c:/opt/perl-blead/site/lib
    c:/opt/perl-blead/lib
    .

As before, uncommitted changes are my changes to the Win32 Makefile.

Snipped test output (full log is about 15,000 lines):

--> Working on Capture::Tiny
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.28.tar.gz
-> OK
Unpacking Capture-Tiny-0.28.tar.gz
Entering Capture-Tiny-0.28
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.17 ... Yes (7.04)
Configuring Capture-Tiny-0.28
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a nmake-style Makefile
Writing Makefile for Capture::Tiny
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Scalar::Util 0 ... Yes (1.41)
Checking if you have strict 0 ... Yes (1.09)
Checking if you have Carp 0 ... Yes (1.36)
Checking if you have Win32API::File 0 ... Yes (0.1202)
Checking if you have File::Temp 0 ... Yes (0.2304)
Checking if you have Test::More 0.62 ... Yes (1.001014)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.04)
Checking if you have lib 0 ... Yes (0.63)
Checking if you have IO::Handle 0 ... Yes (1.35)
Checking if you have IO::File 0 ... Yes (1.16)
Checking if you have warnings 0 ... Yes (1.32)
Checking if you have Exporter 0 ... Yes (5.72)
Checking if you have File::Spec 0 ... Yes (3.56)
Building and testing Capture-Tiny-0.28
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.
cp lib/Capture/Tiny.pm blib\lib\Capture\Tiny.pm
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.
    "C:\opt\perl-blead\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t\*.t
# 
# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker 6.17 7.04
# 
# === Build Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.04
# 
# === Test Requires ===
# 
#     Module              Want     Have
#     ------------------- ---- --------
#     ExtUtils::MakeMaker  any     7.04
#     File::Spec           any     3.56
#     IO::File             any     1.16
#     Test::More          0.62 1.001014
#     lib                  any     0.63
# 
# === Test Recommends ===
# 
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.150001
# 
# === Runtime Requires ===
# 
#     Module         Want   Have
#     -------------- ---- ------
#     Carp            any   1.36
#     Exporter        any   5.72
#     File::Spec      any   3.56
#     File::Temp      any 0.2304
#     IO::Handle      any   1.35
#     Scalar::Util    any   1.41
#     Win32API::File  any 0.1202
#     strict          any   1.09
#     warnings        any   1.32
# 
t\00-report-prereqs.t ...... ok
t\01-Capture-Tiny.t ........ ok
t\02-capture.t ............. ok
#   Failed test 'tee|sys|stdout|short - tee STDERR'
#   at t/lib/Cases.pm line 22.
#          got: 'Warning: unable to close filehandle GEN8 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# Warning: unable to close filehandle GEN6 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# '
#     expected: ''
#   Failed test 'tee|sys|stdout|unicode - tee STDERR'
#   at t/lib/Cases.pm line 22.
#          got: 'Warning: unable to close filehandle GEN16 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# Warning: unable to close filehandle GEN18 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# '
#     expected: ''
#   Failed test 'tee|sys|stdout|multiline - tee STDERR'
#   at t/lib/Cases.pm line 22.
#          got: 'Warning: unable to close filehandle GEN28 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# Warning: unable to close filehandle GEN26 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# '
#     expected: ''
#   Failed test 'tee|sys|empty|short - tee STDERR'
#   at t/lib/Cases.pm line 22.
#          got: 'Warning: unable to close filehandle GEN36 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# Warning: unable to close filehandle GEN38 properly: Bad file descriptor at t/lib/Cases.pm line 170, <$fh> line 1.
# '
#     expected: ''
dagolden commented 9 years ago

With huge thanks to @bulk88 for figuring out the problem!

nanis commented 9 years ago
Configuring Capture-Tiny-release-0.29 ... OK
Building and testing Capture-Tiny-0.29 ... OK
Successfully installed Capture-Tiny-0.29
1 distribution installed

Now, that's what I call a bug hiding in plain sight. Thank you very much @bulk88. This one was driving me crazy.