1N/A chdir 't' if -d 't'; 1N/A # Remove insecure directories from PATH 1N/A ## Match the directory taint tests in mg.c::Perl_magic_setenv() 1N/A ok( open(my $T,'>',$_[0]), "Opened $_[0] successfully" ); 1N/A ok( mkdir($_[0],$_[1]), "Created directory $_[0] successfully" ); 1N/A print "# \$File::Find::dir => '$File::Find::dir'\n"; 1N/A print "# \$_ => '$_'\n"; 1N/A s#\.$## if ($^O eq 'VMS' && $_ ne '.'); 1N/A print "# \$File::Find::dir => '$File::Find::dir'\n"; 1N/A print "# \$_ => '$_'\n"; 1N/A# Use dir_path() to specify a directory path that's expected for 1N/A# $File::Find::dir (%Expect_Dir). Also use it in file operations like 1N/A# dir_path() concatenates directory names to form a *relative* 1N/A# directory path, independent from the platform it's run on, although 1N/A# there are limitations. Don't try to create an absolute path, 1N/A# because that may fail on operating systems that have the concept of 1N/A# volume names (e.g. Mac OS). As a special case, you can pass it a "." 1N/A# as first argument, to create a directory path like "./fa/dir" on 1N/A# operating systems other than Mac OS (actually, Mac OS will ignore 1N/A# the ".", if it's the first argument). If there's no second argument, 1N/A# this function will return the empty string on Mac OS and the string 1N/A # ignore first argument; return a relative path 1N/A # with leading ":" and with trailing ":" 1N/A } else { # $first_arg ne '.' 1N/A# Use topdir() to specify a directory path that you want to pass to 1N/A# above), except that there's no trailing ":" on Mac OS. 1N/A# Use file_path() to specify a file path that's expected for $_ 1N/A# (%Expect_File). Also suitable for file operations like unlink etc. 1N/A# file_path() concatenates directory names (if any) and a filename to 1N/A# form a *relative* file path (the last argument is assumed to be a 1N/A# file). It's independent from the platform it's run on, although 1N/A# there are limitations. As a special case, you can pass it a "." as 1N/A# first argument, to create a file path like "./fa/file" on operating 1N/A# systems other than Mac OS (actually, Mac OS will ignore the ".", if 1N/A# it's the first argument). If there's no second argument, this 1N/A# function will return the empty string on Mac OS and the string "./" 1N/A # ignore first argument; return a relative path 1N/A # with leading ":", but without trailing ":" 1N/A } else { # $first_arg ne '.' 1N/A# Use file_path_name() to specify a file path that's expected for 1N/A# $File::Find::Name (%Expect_Name). Note: When the no_chdir => 1 1N/A# option is in effect, $_ is the same as $File::Find::Name. In that 1N/A# case, also use this function to specify a file path that's expected 1N/A# Basically, file_path_name() does the same as file_path() (see 1N/A# above), except that there's always a leading ":" on Mac OS, even for 1N/Aok( chdir( dir_path('for_find')), 'successful chdir() to for_find' ); 1N/Aprint "# check untainting (no follow)\n"; 1N/A# untainting here should work correctly 1N/A# don't untaint at all, should die 1N/A# untaint pattern doesn't match, should die 1N/A# untaint pattern doesn't match, should die when we chdir to cwd 1N/Aprint "# check untaint_skip (No follow)\n"; 1N/A print "# --- symbolic link tests --- \n"; 1N/A print "# check untainting (follow)\n"; 1N/A # untainting here should work correctly 1N/A # no_chdir is in effect, hence we use file_path_name to specify the expected paths for %Expect_File 1N/A # don't untaint at all, should die 1N/A # untaint pattern doesn't match, should die 1N/A # untaint pattern doesn't match, should die when we chdir to cwd 1N/A print "# check untaint_skip (Follow)\n";