From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Mon, 8 Jan 2007 10:35:04 +0000 (+0000)
Subject: Turn taint warnings (-t) into severe warnings, so they're
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7bf404b7a72f55bf93065ae7b25a5ba0a9ff7f6;p=p5sagit%2Fp5-mst-13.2.git

Turn taint warnings (-t) into severe warnings, so they're
on by default, without having to play games with the
warning bits. Add a test for -t.

p4raw-id: //depot/perl@29717
---

diff --git a/perl.c b/perl.c
index 37671b1..b15348a 100644
--- a/perl.c
+++ b/perl.c
@@ -2061,11 +2061,6 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
     }
 #endif
 
-    if (PL_taint_warn && !(PL_dowarn & (G_WARN_ALL_OFF | G_WARN_ALL_ON | G_WARN_ON))) {
-        PL_compiling.cop_warnings
-	    = Perl_new_warnings_bitfield(aTHX_ NULL, WARN_TAINTstring, WARNsize);
-    }
-
     if (!scriptname)
 	scriptname = argv[0];
     if (PL_e_script) {
@@ -3378,11 +3373,6 @@ Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n");
     case 'w':
 	if (! (PL_dowarn & G_WARN_ALL_MASK)) {
 	    PL_dowarn |= G_WARN_ON;
-	    if (PL_taint_warn) {
-		if (!specialWARN(PL_compiling.cop_warnings))
-		    PerlMemShared_free(PL_compiling.cop_warnings);
-		PL_compiling.cop_warnings = pWARN_STD;
-	    }
 	}
 	s++;
 	return s;
diff --git a/pp_ctl.c b/pp_ctl.c
index 48f2ed6..8506daa 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3389,10 +3389,6 @@ PP(pp_require)
         PL_compiling.cop_warnings = pWARN_ALL ;
     else if (PL_dowarn & G_WARN_ALL_OFF)
         PL_compiling.cop_warnings = pWARN_NONE ;
-    else if (PL_taint_warn && !(PL_dowarn & G_WARN_ON)) {
-        PL_compiling.cop_warnings
-	    = Perl_new_warnings_bitfield(aTHX_ NULL, WARN_TAINTstring, WARNsize);
-    }
     else
         PL_compiling.cop_warnings = pWARN_STD ;
 
diff --git a/t/lib/warnings/taint b/t/lib/warnings/taint
index fd6deed..b0ec91c 100644
--- a/t/lib/warnings/taint
+++ b/t/lib/warnings/taint
@@ -24,12 +24,20 @@ def
 open(FH, "<abc") ;
 $a = <FH> ;
 close FH ;
+chdir $a;
+no warnings 'taint' ;
 chdir $a ;
 print "xxx\n" ;
+use warnings 'taint' ;
+chdir $a ;
+print "yyy\n" ;
 EXPECT
+Insecure dependency in chdir while running with -T switch at - line 5.
+Insecure dependency in chdir while running with -T switch at - line 10.
 xxx
+yyy
 ########
--TU
+-t
 --FILE-- abc
 def
 --FILE--
@@ -37,13 +45,15 @@ def
 open(FH, "<abc") ;
 $a = <FH> ;
 close FH ;
-use warnings 'taint' ;
+chdir $a;
+no warnings 'taint' ;
 chdir $a ;
 print "xxx\n" ;
-no warnings 'taint' ;
+use warnings 'taint' ;
 chdir $a ;
 print "yyy\n" ;
 EXPECT
-Insecure dependency in chdir while running with -T switch at - line 6.
+Insecure dependency in chdir while running with -t switch at - line 5.
+Insecure dependency in chdir while running with -t switch at - line 10.
 xxx
 yyy
diff --git a/taint.c b/taint.c
index 1c74f87..620284c 100644
--- a/taint.c
+++ b/taint.c
@@ -61,7 +61,7 @@ Perl_taint_proper(pTHX_ const char *f, const char *s)
         else
 	    ug = " while running with -T switch";
 	if (PL_unsafe || PL_taint_warn) {
-            if(ckWARN(WARN_TAINT))
+            if(ckWARN_d(WARN_TAINT))
                 Perl_warner(aTHX_ packWARN(WARN_TAINT), f, s, ug);
         }
         else {
diff --git a/warnings.h b/warnings.h
index 9c84c25..c8cd9a5 100644
--- a/warnings.h
+++ b/warnings.h
@@ -83,7 +83,6 @@
 #define WARNsize		12
 #define WARN_ALLstring		"\125\125\125\125\125\125\125\125\125\125\125\125"
 #define WARN_NONEstring		"\0\0\0\0\0\0\0\0\0\0\0\0"
-#define WARN_TAINTstring	"\0\0\0\0\0\0\0\0\0\100\0\0"
 
 #define isLEXWARN_on 	(PL_curcop->cop_warnings != pWARN_STD)
 #define isLEXWARN_off	(PL_curcop->cop_warnings == pWARN_STD)
diff --git a/warnings.pl b/warnings.pl
index 8d89134..3c978d1 100644
--- a/warnings.pl
+++ b/warnings.pl
@@ -319,9 +319,6 @@ print WARN tab(5, '#define WARNsize'),	"$warn_size\n" ;
 #print WARN tab(5, '#define WARN_ALLstring'), '"', ('\377' x $warn_size) , "\"\n" ;
 print WARN tab(5, '#define WARN_ALLstring'), '"', ('\125' x $warn_size) , "\"\n" ;
 print WARN tab(5, '#define WARN_NONEstring'), '"', ('\0' x $warn_size) , "\"\n" ;
-my $WARN_TAINTstring = mkOct($warn_size, map $_ * 2, @{ $list{'taint'} });
-
-print WARN tab(5, '#define WARN_TAINTstring'), qq["$WARN_TAINTstring"\n] ;
 
 print WARN <<'EOM';