diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-14 12:30:46 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-14 12:30:46 +0000 |
commit | 501e7c3490d3750cf17f3dfec24af9ede34f3eb1 (patch) | |
tree | 6bbd2e23f5942c9d535451e973c12d1fb86e2219 | |
parent | d71ae5953aa60e66eceafe3e6e907922ba2e1e63 (diff) | |
parent | f4db54055cd36d83622f77949fd6ab7c67198101 (diff) | |
download | perl-501e7c3490d3750cf17f3dfec24af9ede34f3eb1.tar.gz |
Integrate perlio:
[ 10586]
Add new step to run_byacc which:
A. Corrects #line NNN "perly.c" lines so warnings etc. are trackable
B. Adds extra () to the two if (var = ...) constructs gcc -Wall winges about.
[ 10584]
Hack to remove insecure directories from PATH so test will run.
p4raw-link: @10586 on //depot/perlio: f4db54055cd36d83622f77949fd6ab7c67198101
p4raw-link: @10584 on //depot/perlio: 24e8cdb889e0ad40169b18813ffa9d1841ab8217
p4raw-id: //depot/perl@10588
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.SH | 13 | ||||
-rw-r--r-- | perly.c | 8 | ||||
-rw-r--r-- | perlyline.pl | 11 | ||||
-rwxr-xr-x | t/lib/filefind.t | 153 |
5 files changed, 104 insertions, 82 deletions
@@ -1291,6 +1291,7 @@ perly.c A byacc'ed perly.y perly.fixer A program to remove yacc stack limitations perly.h The header file for perly.c perly.y Yacc grammar for perl +perlyline.pl Perl code to fix #line directives and gcc warnings in perly.c perly_c.diff Fixup perly.c to allow recursion plan9/aperl Shell to make Perl error messages Acme-friendly plan9/arpa/inet.h Plan9 port: replacement C header file diff --git a/Makefile.SH b/Makefile.SH index d56b1205d5..618f1201f8 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -26,7 +26,7 @@ ldlibpth='' DPERL_EXTERNAL_GLOB='-DPERL_EXTERNAL_GLOB' case "$useshrplib" in true) - # Prefix all runs of 'miniperl' and 'perl' with + # Prefix all runs of 'miniperl' and 'perl' with # $ldlibpth so that ./perl finds *this* shared libperl. case "$LD_LIBRARY_PATH" in '') @@ -295,7 +295,7 @@ all: $(FIRSTMAKEFILE) miniperl extra.pods $(private) $(public) $(dynamic_ext) $( compile: all echo "testing compilation" > testcompile; cd utils; $(MAKE) compile; - cd x2p; $(MAKE) compile; + cd x2p; $(MAKE) compile; cd pod; $(MAKE) compile; translators: miniperl lib/Config.pm FORCE @@ -559,7 +559,7 @@ perl.gprof: /usr/bin/gprof perl.gprof.config # Microperl. This is just a convenience thing if one happens to # build also the full Perl and therefore the real big Makefile: -# usually one should manually explicitly issue the below command. +# usually one should manually explicitly issue the below command. microperl: $(MAKE) -f Makefile.micro @@ -594,7 +594,7 @@ preplibrary: miniperl lib/Config.pm lib/lib.pm lib/re.pm autosplit_lib_modules(@ARGV)' lib/*.pm lib/*/*.pm # Take care to avoid modifying lib/Config.pm without reason -# (If trying to create a new port and having problems with the configpm script, +# (If trying to create a new port and having problems with the configpm script, # try 'make minitest' and/or commenting out the tests at the end of configpm.) lib/Config.pm: config.sh miniperl configpm lib/re.pm $(LDLIBPTH) ./miniperl configpm configpm.tmp @@ -686,6 +686,7 @@ run_byacc: FORCE check_byacc -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c sed -e '/^extern YYSTYPE yy/D' y.tab.h >yh.tmp && mv yh.tmp y.tab.h cmp -s y.tab.h perly.h && rm -f y.tab.h || mv y.tab.h perly.h + perl -i perlyline.pl perly.c chmod 664 vms/perly_c.vms vms/perly_h.vms perl vms/vms_yfix.pl perly.c perly.h vms/perly_c.vms vms/perly_h.vms @@ -855,11 +856,11 @@ _cleaner2: rm -f testcompile compilelog -rmdir lib/B lib/Data lib/Digest lib/Encode lib/IO/Socket lib/IO lib/Filter/Util lib/List lib/MIME lib/PerlIO lib/Scalar lib/Sys lib/Thread lib/XS -_realcleaner: +_realcleaner: @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=realclean @$(LDLIBPTH) $(MAKE) _cleaner2 -_verycleaner: +_verycleaner: @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean @$(LDLIBPTH) $(MAKE) _cleaner2 -rm -f *~ *.orig */*~ */*.orig */*/*~ */*/*.orig @@ -1405,7 +1405,7 @@ static char *yyrule[] = { #endif #define yyparse() Perl_yyparse(pTHX) -#line 1481 "perly.c" +#line 1409 "perly.c" #define YYABORT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab @@ -1437,7 +1437,7 @@ yyparse() ysave->oldyylval = yylval; #if YYDEBUG - if (yys = getenv("YYDEBUG")) + if ((yys = getenv("YYDEBUG"))) { yyn = *yys; if (yyn >= '0' && yyn <= '9') @@ -1464,7 +1464,7 @@ yyparse() *yyssp = yystate = 0; yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; + if ((yyn = yydefred[yystate])) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; @@ -2455,7 +2455,7 @@ case 197: #line 786 "perly.y" { yyval.opval = yyvsp[0].opval; } break; -#line 2477 "perly.c" +#line 2459 "perly.c" } yyssp -= yym; yystate = *yyssp; diff --git a/perlyline.pl b/perlyline.pl new file mode 100644 index 0000000000..f360fb41ef --- /dev/null +++ b/perlyline.pl @@ -0,0 +1,11 @@ +$line = 1; +while (<>) + { + $line++; + # 1st correct #line directives for perly.c itself + s/^(#line\s+)\d+(\s*"perly\.c"\s*)$/$1$line$2/; + # now add () round things gcc dislikes + s/if \(yyn = yydefred\[yystate\]\)/if ((yyn = yydefred[yystate]))/; + s/if \(yys = getenv\("YYDEBUG"\)\)/if ((yys = getenv("YYDEBUG")))/; + print; + } diff --git a/t/lib/filefind.t b/t/lib/filefind.t index 1152cdf157..d07948b0ea 100755 --- a/t/lib/filefind.t +++ b/t/lib/filefind.t @@ -24,15 +24,24 @@ else { print "1..75\n"; } use File::Find; use Cwd; +# Remove insecure directories from PATH +my @path; +my $sep = ($^O eq 'MSWin32') ? ';' : ':'; +foreach my $dir (split(/$sep/,$ENV{'PATH'})) + { + push(@path,$dir) unless -w $dir; + } +$ENV{'PATH'} = join($sep,@path); + cleanup(); if ($^O eq 'MacOS') { - find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':'); + find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':'); finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; }, untaint => 1}, ':'); } else { find({wanted => sub { print "ok 1\n" if $_ eq 'filefind.t'; }, untaint => 1, untaint_pattern => qr|^(.+)$|}, '.'); - finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; }, + finddepth({wanted => sub { print "ok 2\n" if $_ eq 'filefind.t'; }, untaint => 1, untaint_pattern => qr|^(.+)$|}, '.'); } @@ -102,14 +111,14 @@ sub MkDir($$) { } sub wanted { - print "# '$_' => 1\n"; + print "# '$_' => 1\n"; s#\.$## if ($^O eq 'VMS' && $_ ne '.'); Check( $Expect{$_} ); if ( $FastFileTests_OK ) { - delete $Expect{$_} + delete $Expect{$_} unless ( $Expect_Dir{$_} && ! -d _ ); } else { - delete $Expect{$_} + delete $Expect{$_} unless ( $Expect_Dir{$_} && ! -d $_ ); } $File::Find::prune=1 if $_ eq 'faba'; @@ -124,7 +133,7 @@ sub dn_wanted { my $OK = exists($Expect{$n}); unless ($^O eq 'MacOS') { if ( $OK ) { - $OK= exists($Expect{substr($n,0,$i)}) if $i >= 0; + $OK= exists($Expect{substr($n,0,$i)}) if $i >= 0; } } Check($OK); @@ -200,17 +209,17 @@ if ($^O eq 'MacOS') { %Expect = (':' => 1, 'fsl' => 1, 'fa_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1, 'faa_ord' => 1); delete $Expect{'fsl'} unless $symlink_exists; - %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, + %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, 'fb' => 1, 'fba' => 1); delete @Expect_Dir{'fb','fba'} unless $symlink_exists; - File::Find::find( {wanted => \&wanted, untaint => 1},':fa' ); + File::Find::find( {wanted => \&wanted, untaint => 1},':fa' ); Check( scalar(keys %Expect) == 0 ); %Expect=(':fa' => 1, ':fa:fsl' => 1, ':fa:fa_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); delete $Expect{':fa:fsl'} unless $symlink_exists; - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, ':fb' => 1, ':fb:fba' => 1); delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists; File::Find::find( {wanted => \&wanted, no_chdir => 1, untaint => 1},':fa' ); @@ -221,7 +230,7 @@ if ($^O eq 'MacOS') { ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1, ':fb' => 1, ':fb:fba' => 1, ':fb:fba:fba_ord' => 1, ':fb:fb_ord' => 1); delete $Expect{':fa:fsl'} unless $symlink_exists; - %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, ':fb' => 1, ':fb:fba' => 1); delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists; File::Find::finddepth( {wanted => \&dn_wanted, untaint => 1 },':' ); @@ -232,7 +241,7 @@ if ($^O eq 'MacOS') { ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1, ':fb' => 1, ':fb:fba' => 1, ':fb:fba:fba_ord' => 1, ':fb:fb_ord' => 1); delete $Expect{':fa:fsl'} unless $symlink_exists; - %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + %Expect_Dir = (':' => 1, ':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, ':fb' => 1, ':fb:fba' => 1); delete @Expect_Dir{':fb',':fb:fba'} unless $symlink_exists; File::Find::finddepth( {wanted => \&d_wanted, no_chdir => 1, untaint => 1 },':' ); @@ -250,14 +259,14 @@ if ($^O eq 'MacOS') { undef $@; eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, - untaint_pattern => qr|^(NO_MATCH)$|},':fa' );}; + untaint_pattern => qr|^(NO_MATCH)$|},':fa' );}; print "# Died: $@"; Check( $@ =~ m|is still tainted| ); chdir($cwd_untainted); print "# check untaint_skip (no follow)\n"; undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, + eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, untaint_pattern => qr|^(NO_MATCH)$|}, ':fa' );}; print "# Died: $@"; Check( $@ =~ m|insecure cwd| ); @@ -265,11 +274,11 @@ if ($^O eq 'MacOS') { print "# check preprocess\n"; %Expect=( - ':' => {fa => 1, fb => 1}, + ':' => {fa => 1, fb => 1}, ':fa:' => {faa => 1, fab => 1, fa_ord => 1}, ':fa:faa:' => {faa_ord => 1}, ':fa:fab:' => {faba => 1, fab_ord => 1}, - ':fa:fab:faba:' => {faba_ord => 1}, + ':fa:fab:faba:' => {faba_ord => 1}, ':fb:' => {fba => 1, fb_ord => 1}, ':fb:fba:' => {fba_ord => 1} ); @@ -295,17 +304,17 @@ if ($^O eq 'MacOS') { %Expect=(':' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1, 'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1, 'faa_ord' => 1); - %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, - 'fb' => 1, 'fba' => 1); + %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, + 'fb' => 1, 'fba' => 1); File::Find::find( {wanted => \&wanted, follow_fast => 1, untaint => 1},':fa' ); - Check( scalar(keys %Expect) == 0 ); + Check( scalar(keys %Expect) == 0 ); %Expect=(':fa' => 1, ':fa:fa_ord' => 1, ':fa:fsl' => 1, ':fa:fsl:fb_ord' => 1, ':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, - ':fb' => 1, ':fb:fba' => 1); + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + ':fb' => 1, ':fb:fba' => 1); File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1 },':fa' ); Check( scalar(keys %Expect) == 0 ); @@ -313,7 +322,7 @@ if ($^O eq 'MacOS') { ':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, ':fb' => 1, ':fb:fba' => 1); File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1 },':fa' ); Check( scalar(keys %Expect) == 0 ); @@ -322,10 +331,10 @@ if ($^O eq 'MacOS') { ':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, ':fb' => 1, ':fb:fba' => 1); File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1, untaint => 1 },':fa' ); - Check( scalar(keys %Expect) == 0 ); + Check( scalar(keys %Expect) == 0 ); # tests below added by Thomas Wegner, 17-05-2001 @@ -340,11 +349,11 @@ if ($^O eq 'MacOS') { %Expect=(':' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1, 'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faba_ord' => 1, 'faa' => 1, 'faa_ord' => 1); - %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, + %Expect_Dir = (':' => 1, 'fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, 'fb' => 1, 'fba' => 1); undef $warn_msg; File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1 }, 'dangling_dir_sl', ':fa' ); - Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| ); + Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| ); unlink ':fa:dangling_file_sl', 'dangling_dir_sl'; print "# check recursion\n"; @@ -352,13 +361,13 @@ if ($^O eq 'MacOS') { undef $@; eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1, untaint => 1 },':fa' ); }; print "# Died: $@"; - Check( $@ =~ m|:for_find:fa:faa:faa_sl is a recursive symbolic link| ); - unlink ':fa:faa:faa_sl'; + Check( $@ =~ m|:for_find:fa:faa:faa_sl is a recursive symbolic link| ); + unlink ':fa:faa:faa_sl'; print "# check follow_skip (file)\n"; CheckDie( symlink(':fa:fa_ord',':fa:fa_ord_sl') ); # symlink to a file undef $@; - eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1,follow_skip => 0, + eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1,follow_skip => 0, no_chdir => 1, untaint => 1 },':fa' );}; print "# Died: $@"; Check( $@ =~ m|:for_find:fa:fa_ord encountered a second time| ); @@ -367,8 +376,8 @@ if ($^O eq 'MacOS') { ':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, - ':fb' => 1, ':fb:fba' => 1); + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + ':fb' => 1, ':fb:fba' => 1); File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1, untaint => 1 },':fa' ); Check( scalar(keys %Expect) == 0 ); @@ -377,24 +386,24 @@ if ($^O eq 'MacOS') { print "# check follow_skip (directory)\n"; CheckDie( symlink(':fa:faa',':fa:faa_sl') ); # symlink to a directory undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, + eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1, untaint => 1 },':fa' );}; print "# Died: $@"; Check( $@ =~ m|:for_find:fa:faa: encountered a second time| ); undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 1, + eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, follow_skip => 1, no_chdir => 1, untaint => 1 },':fa' );}; print "# Died: $@"; - Check( $@ =~ m|:for_find:fa:faa: encountered a second time| ); + Check( $@ =~ m|:for_find:fa:faa: encountered a second time| ); %Expect=(':fa' => 1, ':fa:fa_ord' => 1, ':fa:fsl' => 1, ':fa:fsl:fb_ord' => 1, ':fa:fsl:fba' => 1, ':fa:fsl:fba:fba_ord' => 1, ':fa:fab' => 1, ':fa:fab:fab_ord' => 1, ':fa:fab:faba' => 1, ':fa:fab:faba:faba_ord' => 1, ':fa:faa' => 1, ':fa:faa:faa_ord' => 1); - %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, - ':fb' => 1, ':fb:fba' => 1); - File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1, + %Expect_Dir = (':fa' => 1, ':fa:faa' => 1, ':fa:fab' => 1, ':fa:fab:faba' => 1, + ':fb' => 1, ':fb:fba' => 1); + File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1, untaint => 1},':fa' ); Check( scalar(keys %Expect) == 0 ); unlink ':fa:faa_sl'; @@ -407,7 +416,7 @@ if ($^O eq 'MacOS') { Check( $@ =~ m|Insecure dependency| ); chdir($cwd_untainted); - undef $@; + undef $@; eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, untaint => 1, untaint_pattern => qr|^(NO_MATCH)$|},':fa' );}; print "# Died: $@"; @@ -416,7 +425,7 @@ if ($^O eq 'MacOS') { print "# check untaint_skip (follow)\n"; undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, + eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, untaint_pattern => qr|^(NO_MATCH)$|}, ':fa' );}; print "# Died: $@"; Check( $@ =~ m|insecure cwd| ); @@ -450,7 +459,7 @@ if ($^O eq 'MacOS') { %Expect = ('.' => 1, 'fsl' => 1, 'fa_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1, 'faa_ord' => 1); delete $Expect{'fsl'} unless $symlink_exists; - %Expect_Dir = ('fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, + %Expect_Dir = ('fa' => 1, 'faa' => 1, 'fab' => 1, 'faba' => 1, 'fb' => 1, 'fba' => 1); delete @Expect_Dir{'fb','fba'} unless $symlink_exists; File::Find::find( {wanted => \&wanted, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); @@ -460,7 +469,7 @@ if ($^O eq 'MacOS') { 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); delete $Expect{'fa/fsl'} unless $symlink_exists; - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, 'fb' => 1, 'fb/fba' => 1); delete @Expect_Dir{'fb','fb/fba'} unless $symlink_exists; File::Find::find( {wanted => \&wanted, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); @@ -471,7 +480,7 @@ if ($^O eq 'MacOS') { './fa/fab/faba/faba_ord' => 1, './fa/faa' => 1, './fa/faa/faa_ord' => 1, './fb' => 1, './fb/fba' => 1, './fb/fba/fba_ord' => 1, './fb/fb_ord' => 1); delete $Expect{'./fa/fsl'} unless $symlink_exists; - %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1, + %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1, './fb' => 1, './fb/fba' => 1); delete @Expect_Dir{'./fb','./fb/fba'} unless $symlink_exists; File::Find::finddepth( {wanted => \&dn_wanted , untaint => 1, untaint_pattern => qr|^(.+)$|},'.' ); @@ -482,7 +491,7 @@ if ($^O eq 'MacOS') { './fa/fab/faba/faba_ord' => 1, './fa/faa' => 1, './fa/faa/faa_ord' => 1, './fb' => 1, './fb/fba' => 1, './fb/fba/fba_ord' => 1, './fb/fb_ord' => 1); delete $Expect{'./fa/fsl'} unless $symlink_exists; - %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1, + %Expect_Dir = ('./fa' => 1, './fa/faa' => 1, '/fa/fab' => 1, './fa/fab/faba' => 1, './fb' => 1, './fb/fba' => 1); delete @Expect_Dir{'./fb','./fb/fba'} unless $symlink_exists; File::Find::finddepth( {wanted => \&d_wanted, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$| },'.' ); @@ -500,14 +509,14 @@ if ($^O eq 'MacOS') { undef $@; eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, - untaint_pattern => qr|^(NO_MATCH)$|},'fa' );}; + untaint_pattern => qr|^(NO_MATCH)$|},'fa' );}; print "# Died: $@"; Check( $@ =~ m|is still tainted| ); chdir($cwd_untainted); print "# check untaint_skip (no follow)\n"; undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, + eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, untaint_pattern => qr|^(NO_MATCH)$|}, 'fa' );}; print "# Died: $@"; Check( $@ =~ m|insecure cwd| ); @@ -515,23 +524,23 @@ if ($^O eq 'MacOS') { print "# check preprocess\n"; %Expect=( - '.' => {fa => 1, fb => 1}, + '.' => {fa => 1, fb => 1}, './fa' => {faa => 1, fab => 1, fa_ord => 1}, './fa/faa' => {faa_ord => 1}, './fa/fab' => {faba => 1, fab_ord => 1}, - './fa/fab/faba' => {faba_ord => 1}, + './fa/fab/faba' => {faba_ord => 1}, './fb' => {fba => 1, fb_ord => 1}, './fb/fba' => {fba_ord => 1} ); - File::Find::find( {wanted => \&noop_wanted, preprocess => \&my_preprocess, untaint => 1, + File::Find::find( {wanted => \&noop_wanted, preprocess => \&my_preprocess, untaint => 1, untaint_pattern => qr|^(.+)$|}, '.' ); Check( scalar(keys %Expect) == 0 ); print "# check postprocess\n"; %Expect=('.' => 1, './fa' => 1, './fa/faa' => 1, './fa/fab' => 1, './fa/fab/faba' => 1, './fb' => 1, './fb/fba' => 1 ); - File::Find::find( {wanted => \&noop_wanted, postprocess => \&my_postprocess, untaint => 1, + File::Find::find( {wanted => \&noop_wanted, postprocess => \&my_postprocess, untaint => 1, untaint_pattern => qr|^(.+)$|}, '.' ); Check( scalar(keys %Expect) == 0 ); @@ -548,7 +557,7 @@ if ($^O eq 'MacOS') { %Expect=('.' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1, 'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faa' => 1, 'faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, 'fb' => 1, 'fb/fba' => 1); File::Find::find( {wanted => \&wanted, follow_fast => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); @@ -557,9 +566,9 @@ if ($^O eq 'MacOS') { 'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1, 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, 'fb' => 1, 'fb/fba' => 1); - File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1, + File::Find::find( {wanted => \&wanted, follow_fast => 1, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); @@ -567,9 +576,9 @@ if ($^O eq 'MacOS') { 'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1, 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, - 'fb' => 1, 'fb/fba' => 1); - File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + 'fb' => 1, 'fb/fba' => 1); + File::Find::finddepth( {wanted => \&dn_wanted, follow_fast => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); @@ -577,9 +586,9 @@ if ($^O eq 'MacOS') { 'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1, 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, 'fb' => 1, 'fb/fba' => 1); - File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1, + File::Find::finddepth( {wanted => \&d_wanted, follow_fast => 1, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); @@ -596,38 +605,38 @@ if ($^O eq 'MacOS') { %Expect=('.' => 1, 'fa_ord' => 1, 'fsl' => 1, 'fb_ord' => 1, 'fba' => 1, 'fba_ord' => 1, 'fab' => 1, 'fab_ord' => 1, 'faba' => 1, 'faba_ord' => 1, 'faa' => 1, 'faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, 'fa/fab' => 1, 'fa/fab/faba' => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, 'fa/fab' => 1, 'fa/fab/faba' => 1, 'fb' => 1, 'fb/fba' => 1); undef $warn_msg; - File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1, + File::Find::find( {wanted => \&d_wanted, follow => 1, untaint => 1, untaint_pattern => qr|^(.+)$|}, 'dangling_dir_sl', 'fa' ); - Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| ); + Check( $warn_msg =~ m|dangling_dir_sl is a dangling symbolic link| ); unlink 'fa/dangling_file_sl', 'dangling_dir_sl'; print "# check recursion\n"; CheckDie( symlink('../faa','fa/faa/faa_sl') ); undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1, + eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); }; print "# Died: $@"; - Check( $@ =~ m|for_find/fa/faa/faa_sl is a recursive symbolic link| ); - unlink 'fa/faa/faa_sl'; - + Check( $@ =~ m|for_find/fa/faa/faa_sl is a recursive symbolic link| ); + unlink 'fa/faa/faa_sl'; + print "# check follow_skip (file)\n"; CheckDie( symlink('./fa_ord','fa/fa_ord_sl') ); # symlink to a file undef $@; - eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1, + eval {File::Find::finddepth( {wanted => \&simple_wanted, follow => 1, follow_skip => 0, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' );}; print "# Died: $@"; Check( $@ =~ m|for_find/fa/fa_ord encountered a second time| ); - + %Expect=('fa' => 1, 'fa/fa_ord' => 1, 'fa/fsl' => 1, 'fa/fsl/fb_ord' => 1, 'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1, 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, - 'fb' => 1, 'fb/fba' => 1); - File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1, + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + 'fb' => 1, 'fb/fba' => 1); + File::Find::finddepth( {wanted => \&wanted, follow => 1, follow_skip => 1, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); unlink 'fa/fa_ord_sl'; @@ -650,8 +659,8 @@ if ($^O eq 'MacOS') { 'fa/fsl/fba' => 1, 'fa/fsl/fba/fba_ord' => 1, 'fa/fab' => 1, 'fa/fab/fab_ord' => 1, 'fa/fab/faba' => 1, 'fa/fab/faba/faba_ord' => 1, 'fa/faa' => 1, 'fa/faa/faa_ord' => 1); - %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, - 'fb' => 1, 'fb/fba' => 1); + %Expect_Dir = ('fa' => 1, 'fa/faa' => 1, '/fa/fab' => 1, 'fa/fab/faba' => 1, + 'fb' => 1, 'fb/fba' => 1); File::Find::find( {wanted => \&wanted, follow => 1, follow_skip => 2, no_chdir => 1, untaint => 1, untaint_pattern => qr|^(.+)$|},'fa' ); Check( scalar(keys %Expect) == 0 ); @@ -665,7 +674,7 @@ if ($^O eq 'MacOS') { Check( $@ =~ m|Insecure dependency| ); chdir($cwd_untainted); - undef $@; + undef $@; eval {File::Find::find( {wanted => \&simple_wanted, follow => 1, untaint => 1, untaint_pattern => qr|^(NO_MATCH)$|},'fa' );}; print "# Died: $@"; @@ -674,7 +683,7 @@ if ($^O eq 'MacOS') { print "# check untaint_skip (follow)\n"; undef $@; - eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, + eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, untaint_pattern => qr|^(NO_MATCH)$|}, 'fa' );}; print "# Died: $@"; Check( $@ =~ m|insecure cwd| ); |