Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 64404
Status: resolved
Priority: 0/
Queue: Test-Harness

People
Owner: andy [...] hexten.net
Requestors: stuart [...] morungos.com
Cc:
AdminCc:

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



Subject: Null byte in __DATA__ in test scripts breaks prove
I believe found an issue in Test::Harness causing it to fail when processing test files which have a null byte in a __DATA__ segment. When a null byte is present, for some strange reason the @INC fails to work. Here is how I created it. File: lib/MyClass.pm << package MyClass; use strict; use warnings; 1; Show quoted text
>>
File: t/taptest.t << use strict; use MyClass; __DATA__ asdf^@ ddd Show quoted text
>>
The ^@ shows where a null byte is present. When the command "prove -Ilib t/taptest.t" is run, you get an error as follows (note that the command "perl -Ilib t/taptest.t" does not fail. t/taptest.t .. Can't locate MyClass.pm in @INC (@INC contains: /Users/stuart/perl/lib/site_perl/5.12.1/darwin-multi-2level /Users/stuart/perl/lib/site_perl/5.12.1 /Users/stuart/perl/lib/5.12.1/darwin-multi-2level /Users/stuart/perl/lib/5.12.1 .) at t/taptest.t line 2. BEGIN failed--compilation aborted at t/taptest.t line 2. t/taptest.t .. Dubious, test returned 2 (wstat 512, 0x200) No subtests run Test Summary Report ------------------- t/taptest.t (Wstat: 512 Tests: 0 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=1, Tests=0, 0 wallclock secs ( 0.03 usr + 0.01 sys = 0.04 CPU) Result: FAIL This was based on a self-compiled 5.12.1 on OSX, but the problem has been traced from a bad test in RTF::Parser, with many failures on different platforms. The problem only shows on non-installed modules, and it appears that in some extremely strange fashion the null byte is interfering with the @INC passed to the script.
This is caused by Test::Harness' use of -T $test to determine whether a test is a script or a binary. Fixed in commit 4c363f99f33ee90e4145592f17e1fac3cf3d5b51 Author: Andy Armstrong <andy@hexten.net> Date: Sun Apr 17 16:26:56 2011 +0100 Ignore textness ('-T') of script when reading shebang. [#64404]. Thanks!