develooper Front page | perl.perl5.changes | Postings from May 2011

[perl.git] branch blead, updated. v5.14.0-284-g77b8b9a

From:
Karl Williamson
Date:
May 27, 2011 07:38
Subject:
[perl.git] branch blead, updated. v5.14.0-284-g77b8b9a
Message ID:
E1QPyBE-00057K-H0@camel.ams6.corp.booking.com
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/77b8b9aded596134eb5091b72ad4d9cf361a7c94?hp=07fd1c9cb43c1268e72f10b8cde38fb3179fb04e>

- Log -----------------------------------------------------------------
commit 77b8b9aded596134eb5091b72ad4d9cf361a7c94
Author: Karl Williamson <public@khwilliamson.com>
Date:   Fri May 27 08:28:59 2011 -0600

    podcheck.t: Guard against transitory files
    
    podcheck uses File::Find to look for pods in the directory structure.
    It is possible for the Find to find a transitory file that is gone by
    the time the file is opened for examination.  This patch will simply
    skip the transitory file if the open fails and it's because it no longer
    exists.  (There is a tiny window in which the open could fail, and
    the file gets recreated and hence passes the exists test, but I'm not
    bothering to code for that until it actually happens.)
-----------------------------------------------------------------------

Summary of changes:
 t/porting/podcheck.t |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t
index 2a7c87b..6d987b2 100644
--- a/t/porting/podcheck.t
+++ b/t/porting/podcheck.t
@@ -926,7 +926,9 @@ sub extract_pod {   # Extracts just the pod from a file
     open my $in_fh, '<:bytes', $filename
 
         # The file should already have been opened once to get here, so if
-        # fails, just die.
+        # fails, just die.  It's possible that a transitory file containing a
+        # pod would get here, but not bothering to add code for that very
+        # unlikely event.
         or die "Can't open '$filename': $!\n";
 
     my $parser = Pod::Parser->new();
@@ -965,11 +967,14 @@ sub is_pod_file {
         my $candidate;
         if (! open $candidate, '<:bytes', $_) {
 
-            # If it is a broken symbolic link, just skip the file, as it
-            # is probably just a build problem; certainly not a file that
-            # we would want to check the pod of.  Otherwise fail it here
-            # and no reason to process it further.
-            ok(0, "Can't open '$filename': $!") if ! -l $filename;
+            # If a transitory file was found earlier, the open could fail
+            # legitimately and we just skip the file; also skip it if it is a
+            # broken symbolic link, as it is probably just a build problem;
+            # certainly not a file that we would want to check the pod of.
+            # 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;
             return;
         }
         <$candidate>;

--
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About