diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-10-03 20:49:10 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-10-03 21:06:16 -0600 |
commit | e42a86f0e11f91b8eee790c295d00ba87157989c (patch) | |
tree | a24bc5ba93f9cd737c3cd0c9cf1b2d400f6ce212 | |
parent | eb31523687db18ab802034a6b56659a16381a1b6 (diff) | |
download | perl-e42a86f0e11f91b8eee790c295d00ba87157989c.tar.gz |
podcheck.t: Guard against weird input file types
This causes podcheck to only analyze non-zero length files that we can
read and are plain files or symbolic links.
Perhaps symbolic links should be skipped as well. In the current blead,
experimenting with doing that made no difference.
-rw-r--r-- | t/porting/podcheck.t | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t index 8d47b86c3a..dbf6fb9d31 100644 --- a/t/porting/podcheck.t +++ b/t/porting/podcheck.t @@ -1249,7 +1249,7 @@ my $digest = Digest->new($digest_type); sub is_pod_file { # If $_ is a pod file, add it to the lists and do other prep work. - if (-d $_) { + if (-d) { # Don't look at files in directories that are for tests, nor those # beginning with a dot if ($_ eq 't' || $_ =~ /^\../) { @@ -1258,6 +1258,10 @@ sub is_pod_file { return; } + return unless -r && -s; # Can't check it if can't read it; no need to + # check if 0 length + return unless -f || -l; # Weird file types won't be pods + if ($_ =~ /^\./ # No hidden Unix files || $_ =~ $non_pods) { note("Not considering $_") if DEBUG; @@ -1283,7 +1287,7 @@ sub is_pod_file { # Otherwise fail it here and no reason to process it further. # (But the test count will be off too) ok(0, "Can't open '$filename': $!") - if -e $filename && ! -l $filename; + if -r $filename && ! -l $filename; return; } <$candidate>; |