summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-23 16:04:38 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-23 16:04:38 +0000
commit343d3f38aaddb9ab6fe1187337ca19ffb0f71000 (patch)
treee772868de99b2da81e1fca6d6e4988aa4f9676c7
parente1a6f43996336c470b80243ea4eb2bd64a96dc7f (diff)
downloadperl-343d3f38aaddb9ab6fe1187337ca19ffb0f71000.tar.gz
cygwin needs cygwin1.dll in PATH or cwd to run external programs.
cygwin does not taint cwd, just like win32. p4raw-id: //depot/perl@10868
-rw-r--r--lib/File/Find/taint.t11
-rwxr-xr-xt/op/taint.t7
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/File/Find/taint.t b/lib/File/Find/taint.t
index fb3dfc2751..f27c42c5fc 100644
--- a/lib/File/Find/taint.t
+++ b/lib/File/Find/taint.t
@@ -34,6 +34,8 @@ foreach my $dir (split(/$sep/,$ENV{'PATH'}))
}
$ENV{'PATH'} = join($sep,@path);
+my $NonTaintedCwd = $^O eq 'MSWin32' || $^O eq 'cygwin';
+
cleanup();
find({wanted => sub { print "ok 1\n" if $_ eq 'commonsense.t'; },
@@ -321,7 +323,7 @@ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1,
print "# $@" if $@;
#$^D = 8;
-if ($^O eq 'MSWin32') {
+if ($NonTaintedCwd) {
Skip("$^O does not taint cwd");
}
else {
@@ -394,7 +396,12 @@ if ( $symlink_exists ) {
eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1,
untaint_skip => 1, untaint_pattern =>
qr|^(NO_MATCH)$|}, topdir('fa') );};
- Check( $@ =~ m|insecure cwd| );
+ if ($NonTaintedCwd) {
+ Skip("$^O does not taint cwd");
+ }
+ else {
+ Check( $@ =~ m|insecure cwd| );
+ }
chdir($cwd_untainted);
}
diff --git a/t/op/taint.t b/t/op/taint.t
index c2bb2f8705..effb12c3b0 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -42,6 +42,7 @@ my $Is_VMS = $^O eq 'VMS';
my $Is_MSWin32 = $^O eq 'MSWin32';
my $Is_NetWare = $^O eq 'NetWare';
my $Is_Dos = $^O eq 'dos';
+my $Is_Cygwin = $^O eq 'cygwin';
my $Invoke_Perl = $Is_VMS ? 'MCR Sys$Disk:[]Perl.' :
($Is_MSWin32 ? '.\perl' :
($Is_NetWare ? 'perl' : './perl'));
@@ -120,6 +121,12 @@ print "1..174\n";
delete @ENV{@MoreEnv};
$ENV{TERM} = 'dumb';
+ if ($Is_Cygwin) {
+ system("/usr/bin/cp /usr/bin/cygwin1.dll .") &&
+ die "$0: failed to cp cygwin1.dll: $!\n";
+ END { unlink "cygwin1.dll" } # yes, done for all platforms...
+ }
+
test 1, eval { `$echo 1` } eq "1\n";
if ($Is_MSWin32 || $Is_NetWare || $Is_VMS || $Is_Dos) {