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

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