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

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

Thread Previous | Thread Next
From:
rgarciasuarez
Date:
October 31, 2001 05:38
Subject:
[REPATCH 2] Re: [ID 20011030.064] File::Temp tempdir (CLEANUP => 1) and -T on OpenBSD 2.9
Message ID:
slrn9tvvmi.9o.rgarciasuarez@rafael.kazibao.net
Benjamin Goldberg wrote :
> Rafael Garcia-Suarez wrote:
> [snip]
> > +                   @files = map { /^(.*)\z/ ; $1 } readdir $d;
> 
> AFAIK, it's perfectly valid to have a newline in a filename.  Not that
> it's a good idea to do it, but it's possible.  So add a /s flag, I guess

And with /s, \z can be replaced by $, which is more backwards-compatible.
Next iteration :

--- 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 { /^(.*)$/s ; $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


Thread Previous | Thread Next


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