Skip Menu |

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

Report information
The Basics
Id: 119897
Status: resolved
Priority: 0/
Queue: Test-Taint

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.06
Fixed in: (no value)



Subject: Tests fails randomly with recent Test::Simple: Failed test '$ENV{TEST_ACTIVE} is tainted'
One can observe random test failures due to running tests on non-tainted environment variables injected by Test::Simple: # Failed test '$ENV{TEST_ACTIVE} is tainted' # at t/tainted_ok.t line 12. # Looks like you failed 1 test of 3. t/tainted_ok.t ......... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/3 subtests t/tainted_ok_deeply.t .. ok Attached patch fixes it.
Subject: Test-Taint-1.06-Test-taintedness-on-X-instead-of-environment-variabl.patch
From cab25a93c2e8383cff35f55271a60f51645c98ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 18 Jan 2017 11:02:39 +0100 Subject: [PATCH] Test taintedness on $^X instead of environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test::Simple adds TEST_ACTIVE and TEST2_ACTIVE members into %Env. These are not tainted. t/tainted_ok.t and t/tainted.t tests can fail if they pick up one of them. This patch changes the tests to use $^X, interpreter path, instead as discussed and implemented in simalar Scalar-List-Utils' bug <https://rt.cpan.org/Public/Bug/Display.html?id=119169>. Signed-off-by: Petr Písař <ppisar@redhat.com> --- t/tainted.t | 7 ++----- t/tainted_ok.t | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/t/tainted.t b/t/tainted.t index bf1e629..f5fb6d1 100644 --- a/t/tainted.t +++ b/t/tainted.t @@ -7,11 +7,8 @@ use Test::More tests => 6; use Test::Taint; -my @keys = keys %ENV; -my $key = shift @keys; - taint_checking_ok(); -ok( tainted($ENV{$key}), "\$ENV{$key} is tainted" ); +ok( tainted($^X), "\$^X is tainted" ); my $foo = 43; ok( !tainted($foo), '43 is not tainted' ); @@ -21,7 +18,7 @@ RESET_SIG_DIE: { local $SIG{__DIE__} = sub { $counter++ }; - ok( tainted($ENV{$key}), "\$ENV{$key} is tainted" ); + ok( tainted($^X), "\$^X is tainted" ); is($counter, 0, 'counter was not incremented (our die did not fire)'); eval { die 'validly' }; diff --git a/t/tainted_ok.t b/t/tainted_ok.t index 2dcc9db..ce87343 100644 --- a/t/tainted_ok.t +++ b/t/tainted_ok.t @@ -5,11 +5,8 @@ use strict; use Test::Taint tests=>3; -my @keys = keys %ENV; -my $key = shift @keys; - taint_checking_ok(); -tainted_ok( $ENV{$key}, "\$ENV{$key} is tainted" ); +tainted_ok( $^X, "\$^X is tainted" ); my $foo = 43; untainted_ok( $foo ); -- 2.7.4
On Wed Jan 18 05:11:44 2017, ppisar wrote: Show quoted text
> One can observe random test failures due to running tests on non- > tainted environment variables injected by Test::Simple: > > # Failed test '$ENV{TEST_ACTIVE} is tainted' > # at t/tainted_ok.t line 12. > # Looks like you failed 1 test of 3. > t/tainted_ok.t ......... > Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/3 subtests > t/tainted_ok_deeply.t .. ok > > Attached patch fixes it.
As part of preparation for the release of perl-5.30, I have been testing the "CPAN River 3000" against monthly dev releases on FreeBSD-11.2. In the run of this program for perl-5.29.10 this past weekend, I encountered a failure like the above. ##### "# Testing Test::Taint 1.06, Perl 5.029010, /usr/home/jkeenan/var/tad/testing/perl-5.29.10/bin/perl", "t/00.load.t ............ ok", "t/no-dash-T.t .......... ok", "t/pod-coverage.t ....... ok", "t/pod.t ................ ok", "t/taint.t .............. ok", "t/taint_deeply.t ....... ok", "", "# Failed test '\$ENV{TEST_ACTIVE} is tainted'", "# at t/tainted.t line 14.", "", "# Failed test '\$ENV{TEST_ACTIVE} is tainted'", "# at t/tainted.t line 24.", "# Looks like you failed 2 tests of 6.", "t/tainted.t ............ ", "Dubious, test returned 2 (wstat 512, 0x200)", "Failed 2/6 subtests ", "t/tainted_ok.t ......... ok", "t/tainted_ok_deeply.t .. ok", "", ##### The failures are intermittent and can be generated by running 'make test' or 'prove' repeatedly. Please consider applying the patch submitted a couple of years ago by ppisar. Thank you very much. Jim Keenan
This has been fixed in 1.08, which I just released. Thanks.