You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/10/20 23:11:07 UTC

svn commit: r1904751 - /spamassassin/trunk/t/SATest.pm

Author: sidney
Date: Thu Oct 20 23:11:06 2022
New Revision: 1904751

URL: http://svn.apache.org/viewvc?rev=1904751&view=rev
Log:
Bug 8067 - Work around error thrown by Cwd::realpath on older Windows perl when path does not exist

Modified:
    spamassassin/trunk/t/SATest.pm

Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?rev=1904751&r1=1904750&r2=1904751&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Thu Oct 20 23:11:06 2022
@@ -77,12 +77,12 @@ BEGIN {
         map {
               my $pathdir = $_;
               $pathdir =~ s/\\*\z//;
-              my $abspathdir = File::Spec->canonpath(Cwd::realpath($pathdir));
+              my $abspathdir = File::Spec->canonpath(Cwd::realpath($pathdir)) if (-d $pathdir);
               if (defined $abspathdir) {
                 $abspathdir  =~ /^(.*)\z/s;
                 $abspathdir = $1; # untaint it
               }
-              ((defined $abspathdir) and (lc $pathdir eq lc $abspathdir) and (-d $abspathdir))?($abspathdir):()
+              ((defined $abspathdir) and (lc $pathdir eq lc $abspathdir))?($abspathdir):()
             }
           @pathdirs);
   }
@@ -151,12 +151,12 @@ sub sa_t_init {
     join(' -I', # filter for only dirs that are absolute paths that exist, then canonicalize them
       map {
             my $pathdir = $_;
-            my $canonpathdir = File::Spec->canonpath(Cwd::realpath($pathdir)) if (File::Spec->file_name_is_absolute($pathdir));
+            my $canonpathdir = File::Spec->canonpath(Cwd::realpath($pathdir)) if ((-d $pathdir) and File::Spec->file_name_is_absolute($pathdir));
             if (defined $canonpathdir) {
                $canonpathdir =~ /^(.*)\z/s;
                $canonpathdir = $1; # untaint it
             }
-            ((defined $canonpathdir) and (-d $canonpathdir))?($canonpathdir):()
+            ((defined $canonpathdir))?($canonpathdir):()
           }
          @pathdirs);
   $perl_cmd .= " -I$inc_opts" if ($inc_opts);