develooper Front page | perl.perl5.porters | Postings from October 2001

[REPATCH] Re: [PATCH] Re: [ID 20011030.064] File::Temp tempdir (CLEANUP => 1) and -T on OpenBSD 2.9

From:
rgarciasuarez
Date:
October 31, 2001 00:52
Subject:
[REPATCH] Re: [PATCH] Re: [ID 20011030.064] File::Temp tempdir (CLEANUP => 1) and -T on OpenBSD 2.9
Message ID:
slrn9tveug.usd.rgarciasuarez@rafael.kazibao.net
Tim Jenness wrote in perl.perl5.porters:
> 
> Well, if you didn't mind the extra overhead you could always untaint it
> regardless of whether tain mode is on or not. Then the patch would work on
> older perls (since I'm assuming the person who filed the bug would like it
> fixed on their current version).

Or we could test the definedness of ${"\cTAINT"} : if it's undefined,
$^TAINT is not supported. Works even with perl 5.005_03. (I use the
syntax \cTAINT for backwards compatibility).

Repatch:

--- lib/File/Path.pm.orig	Fri Sep 21 20:11:58 2001
+++ lib/File/Path.pm	Tue Oct 30 22:11:43 2001
@@ -98,7 +98,7 @@
 use strict;
 use warnings;
 
-our $VERSION = "1.0405";
+our $VERSION = "1.05";
 our @ISA = qw( Exporter );
 our @EXPORT = qw( mkpath rmtree );
 
@@ -180,7 +180,12 @@
 		unless $safe;
 
 	    if (opendir my $d, $root) {
-		@files = readdir $d;
+		if (!defined ${"\cTAINT"} or ${"\cTAINT"}) {
+		    # Blindly untaint dir names
+		    @files = map { /^(.*)\z/ ; $1 } readdir $d;
+		} else {
+		    @files = readdir $d;
+		}
 		closedir $d;
 	    }
 	    else {
--- lib/File/Path.t.orig	Mon Jun 18 07:21:16 2001
+++ lib/File/Path.t	Tue Oct 30 22:10:08 2001
@@ -1,4 +1,4 @@
-#!./perl
+#!./perl -wT
 
 BEGIN {
     chdir 't' if -d 't';
--- lib/File/Temp/t/mktemp.t.orig	Thu Jun 21 16:46:53 2001
+++ lib/File/Temp/t/mktemp.t	Tue Oct 30 22:13:43 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -wT
 
 # Test for mktemp family of commands in File::Temp
 # Use STANDARD safe level for these tests




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About