Blame SOURCES/Test-Taint-1.06-Test-taintedness-on-X-instead-of-environment-variabl.patch

e5945e
From cab25a93c2e8383cff35f55271a60f51645c98ff Mon Sep 17 00:00:00 2001
e5945e
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
e5945e
Date: Wed, 18 Jan 2017 11:02:39 +0100
e5945e
Subject: [PATCH] Test taintedness on $^X instead of environment variables
e5945e
MIME-Version: 1.0
e5945e
Content-Type: text/plain; charset=UTF-8
e5945e
Content-Transfer-Encoding: 8bit
e5945e
e5945e
Test::Simple adds TEST_ACTIVE and TEST2_ACTIVE members into %Env.
e5945e
These are not tainted. t/tainted_ok.t and t/tainted.t tests can fail
e5945e
if they pick up one of them.
e5945e
e5945e
This patch changes the tests to use $^X, interpreter path, instead as
e5945e
discussed and implemented in simalar Scalar-List-Utils' bug
e5945e
<https://rt.cpan.org/Public/Bug/Display.html?id=119169>.
e5945e
e5945e
Signed-off-by: Petr Písař <ppisar@redhat.com>
e5945e
---
e5945e
 t/tainted.t    | 7 ++-----
e5945e
 t/tainted_ok.t | 5 +----
e5945e
 2 files changed, 3 insertions(+), 9 deletions(-)
e5945e
e5945e
diff --git a/t/tainted.t b/t/tainted.t
e5945e
index bf1e629..f5fb6d1 100644
e5945e
--- a/t/tainted.t
e5945e
+++ b/t/tainted.t
e5945e
@@ -7,11 +7,8 @@ use Test::More tests => 6;
e5945e
 
e5945e
 use Test::Taint;
e5945e
 
e5945e
-my @keys = keys %ENV;
e5945e
-my $key = shift @keys;
e5945e
-
e5945e
 taint_checking_ok();
e5945e
-ok( tainted($ENV{$key}), "\$ENV{$key} is tainted" );
e5945e
+ok( tainted($^X), "\$^X is tainted" );
e5945e
 
e5945e
 my $foo = 43;
e5945e
 ok( !tainted($foo), '43 is not tainted' );
e5945e
@@ -21,7 +18,7 @@ RESET_SIG_DIE: {
e5945e
 
e5945e
     local $SIG{__DIE__} = sub { $counter++ };
e5945e
 
e5945e
-    ok( tainted($ENV{$key}), "\$ENV{$key} is tainted" );
e5945e
+    ok( tainted($^X), "\$^X is tainted" );
e5945e
     is($counter, 0, 'counter was not incremented (our die did not fire)');
e5945e
 
e5945e
     eval { die 'validly' };
e5945e
diff --git a/t/tainted_ok.t b/t/tainted_ok.t
e5945e
index 2dcc9db..ce87343 100644
e5945e
--- a/t/tainted_ok.t
e5945e
+++ b/t/tainted_ok.t
e5945e
@@ -5,11 +5,8 @@ use strict;
e5945e
 
e5945e
 use Test::Taint tests=>3;
e5945e
 
e5945e
-my @keys = keys %ENV;
e5945e
-my $key = shift @keys;
e5945e
-
e5945e
 taint_checking_ok();
e5945e
-tainted_ok( $ENV{$key}, "\$ENV{$key} is tainted" );
e5945e
+tainted_ok( $^X, "\$^X is tainted" );
e5945e
 
e5945e
 my $foo = 43;
e5945e
 untainted_ok( $foo );
e5945e
-- 
e5945e
2.7.4
e5945e