From e42a86f0e11f91b8eee790c295d00ba87157989c Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 3 Oct 2011 20:49:10 -0600 Subject: [PATCH] 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. --- t/porting/podcheck.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t index 8d47b86..dbf6fb9 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>; -- 2.7.4