Blame SOURCES/PathTools-3.75-Upgrade-to-3.78.patch

48b349
From 3c570b93e7ca990b3274219dd828e8fdaac0bf9d Mon Sep 17 00:00:00 2001
48b349
From: Jitka Plesnikova <jplesnik@redhat.com>
48b349
Date: Thu, 25 Apr 2019 17:04:30 +0200
48b349
Subject: [PATCH] Upgrade to 3.78
48b349
48b349
---
48b349
 Cwd.pm                     |  8 ++++++--
48b349
 lib/File/Spec.pm           |  2 +-
48b349
 lib/File/Spec/AmigaOS.pm   |  2 +-
48b349
 lib/File/Spec/Cygwin.pm    |  2 +-
48b349
 lib/File/Spec/Epoc.pm      |  2 +-
48b349
 lib/File/Spec/Functions.pm |  2 +-
48b349
 lib/File/Spec/Mac.pm       |  2 +-
48b349
 lib/File/Spec/OS2.pm       |  2 +-
48b349
 lib/File/Spec/Unix.pm      |  2 +-
48b349
 lib/File/Spec/Win32.pm     | 14 ++------------
48b349
 t/Spec.t                   |  4 ++--
48b349
 t/cwd.t                    | 11 ++++++++++-
48b349
 t/cwd_enoent.t             |  9 ++++++---
48b349
 13 files changed, 34 insertions(+), 28 deletions(-)
48b349
48b349
diff --git a/Cwd.pm b/Cwd.pm
48b349
index 16d5b11..9b173c2 100644
48b349
--- a/Cwd.pm
48b349
+++ b/Cwd.pm
48b349
@@ -3,7 +3,7 @@ use strict;
48b349
 use Exporter;
48b349
 
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 my $xs_version = $VERSION;
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
@@ -171,7 +171,7 @@ if($^O ne 'MSWin32') {
48b349
 if ($^O =~ /android/) {
48b349
     # If targetsh is executable, then we're either a full
48b349
     # perl, or a miniperl for a native build.
48b349
-    if (-x $Config::Config{targetsh}) {
48b349
+    if ( exists($Config::Config{targetsh}) && -x $Config::Config{targetsh}) {
48b349
         $pwd_cmd = "$Config::Config{targetsh} -c pwd"
48b349
     }
48b349
     else {
48b349
@@ -659,6 +659,10 @@ if (exists $METHOD_MAP{$^O}) {
48b349
   }
48b349
 }
48b349
 
48b349
+# built-in from 5.30
48b349
+*getcwd = \&Internals::getcwd
48b349
+  if !defined &getcwd && defined &Internals::getcwd;
48b349
+
48b349
 # In case the XS version doesn't load.
48b349
 *abs_path = \&_perl_abs_path unless defined &abs_path;
48b349
 *getcwd = \&_perl_getcwd unless defined &getcwd;
48b349
diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm
48b349
index eb3b55a..7fe3272 100644
48b349
--- a/lib/File/Spec.pm
48b349
+++ b/lib/File/Spec.pm
48b349
@@ -2,7 +2,7 @@ package File::Spec;
48b349
 
48b349
 use strict;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 my %module = (
48b349
diff --git a/lib/File/Spec/AmigaOS.pm b/lib/File/Spec/AmigaOS.pm
48b349
index 1355768..2b7d18a 100644
48b349
--- a/lib/File/Spec/AmigaOS.pm
48b349
+++ b/lib/File/Spec/AmigaOS.pm
48b349
@@ -3,7 +3,7 @@ package File::Spec::AmigaOS;
48b349
 use strict;
48b349
 require File::Spec::Unix;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 our @ISA = qw(File::Spec::Unix);
48b349
diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm
48b349
index 9dc15a1..d44ced3 100644
48b349
--- a/lib/File/Spec/Cygwin.pm
48b349
+++ b/lib/File/Spec/Cygwin.pm
48b349
@@ -3,7 +3,7 @@ package File::Spec::Cygwin;
48b349
 use strict;
48b349
 require File::Spec::Unix;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 our @ISA = qw(File::Spec::Unix);
48b349
diff --git a/lib/File/Spec/Epoc.pm b/lib/File/Spec/Epoc.pm
48b349
index bd87b68..b611cd9 100644
48b349
--- a/lib/File/Spec/Epoc.pm
48b349
+++ b/lib/File/Spec/Epoc.pm
48b349
@@ -2,7 +2,7 @@ package File::Spec::Epoc;
48b349
 
48b349
 use strict;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 require File::Spec::Unix;
48b349
diff --git a/lib/File/Spec/Functions.pm b/lib/File/Spec/Functions.pm
48b349
index 19ab4db..3f617bd 100644
48b349
--- a/lib/File/Spec/Functions.pm
48b349
+++ b/lib/File/Spec/Functions.pm
48b349
@@ -3,7 +3,7 @@ package File::Spec::Functions;
48b349
 use File::Spec;
48b349
 use strict;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 require Exporter;
48b349
diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm
48b349
index 926a5dd..d920d2f 100644
48b349
--- a/lib/File/Spec/Mac.pm
48b349
+++ b/lib/File/Spec/Mac.pm
48b349
@@ -4,7 +4,7 @@ use strict;
48b349
 use Cwd ();
48b349
 require File::Spec::Unix;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 our @ISA = qw(File::Spec::Unix);
48b349
diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm
48b349
index 4404fe8..603781a 100644
48b349
--- a/lib/File/Spec/OS2.pm
48b349
+++ b/lib/File/Spec/OS2.pm
48b349
@@ -4,7 +4,7 @@ use strict;
48b349
 use Cwd ();
48b349
 require File::Spec::Unix;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 our @ISA = qw(File::Spec::Unix);
48b349
diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm
48b349
index cd29f76..6749e60 100644
48b349
--- a/lib/File/Spec/Unix.pm
48b349
+++ b/lib/File/Spec/Unix.pm
48b349
@@ -3,7 +3,7 @@ package File::Spec::Unix;
48b349
 use strict;
48b349
 use Cwd ();
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 =head1 NAME
48b349
diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm
48b349
index 0cf0e28..5934010 100644
48b349
--- a/lib/File/Spec/Win32.pm
48b349
+++ b/lib/File/Spec/Win32.pm
48b349
@@ -5,7 +5,7 @@ use strict;
48b349
 use Cwd ();
48b349
 require File::Spec::Unix;
48b349
 
48b349
-our $VERSION = '3.75';
48b349
+our $VERSION = '3.78';
48b349
 $VERSION =~ tr/_//d;
48b349
 
48b349
 our @ISA = qw(File::Spec::Unix);
48b349
@@ -137,7 +137,7 @@ sub catfile {
48b349
     # Legacy / compatibility support
48b349
     #
48b349
     shift, return _canon_cat( "/", @_ )
48b349
-	if $_[0] eq "";
48b349
+	if !@_ || $_[0] eq "";
48b349
 
48b349
     # Compatibility with File::Spec <= 3.26:
48b349
     #     catfile('A:', 'foo') should return 'A:\foo'.
48b349
@@ -407,16 +407,6 @@ sub _canon_cat				# @path -> path
48b349
 	       )+			# performance boost -- I do not know why
48b349
 	     }{\\}gx;
48b349
 
48b349
-    # XXX I do not know whether more dots are supported by the OS supporting
48b349
-    #     this ... annotation (NetWare or symbian but not MSWin32).
48b349
-    #     Then .... could easily become ../../.. etc:
48b349
-    # Replace \.\.\. by (\.\.\.+)  and substitute with
48b349
-    # { $1 . ".." . "\\.." x (length($2)-2) }gex
48b349
-	     				# ... --> ../..
48b349
-    $path =~ s{ (\A|\\)			# at begin or after a slash
48b349
-    		\.\.\.
48b349
-		(?=\\|\z) 		# at end or followed by slash
48b349
-	     }{$1..\\..}gx;
48b349
     					# xx\yy\..\zz --> xx\zz
48b349
     while ( $path =~ s{(?:
48b349
 		(?:\A|\\)		# at begin or after a slash
48b349
diff --git a/t/Spec.t b/t/Spec.t
48b349
index 1b26190..c953391 100644
48b349
--- a/t/Spec.t
48b349
+++ b/t/Spec.t
48b349
@@ -277,9 +277,9 @@ my @tests = (
48b349
 [ "Win32->canonpath('//a/b/../../c')",  '\\\\a\\b\\c'         ],
48b349
 [ "Win32->canonpath('//a/b/c/../d')",   '\\\\a\\b\\d'         ],
48b349
 [ "Win32->canonpath('//a/b/c/../../d')",'\\\\a\\b\\d'         ],
48b349
-[ "Win32->canonpath('//a/b/c/.../d')",  '\\\\a\\b\\d'         ],
48b349
+[ "Win32->canonpath('//a/b/c/.../d')",  '\\\\a\\b\\c\\...\\d' ],
48b349
 [ "Win32->canonpath('/a/b/c/../../d')", '\\a\\d'              ],
48b349
-[ "Win32->canonpath('/a/b/c/.../d')",   '\\a\\d'              ],
48b349
+[ "Win32->canonpath('/a/b/c/.../d')",   '\\a\\b\\c\\...\\d'   ],
48b349
 [ "Win32->canonpath('\\../temp\\')",    '\\temp'              ],
48b349
 [ "Win32->canonpath('\\../')",          '\\'                  ],
48b349
 [ "Win32->canonpath('\\..\\')",         '\\'                  ],
48b349
diff --git a/t/cwd.t b/t/cwd.t
48b349
index 483b437..c056938 100644
48b349
--- a/t/cwd.t
48b349
+++ b/t/cwd.t
48b349
@@ -10,6 +10,7 @@ chdir 't';
48b349
 use Config;
48b349
 use File::Spec;
48b349
 use File::Path;
48b349
+use Errno qw(EACCES);
48b349
 
48b349
 use lib File::Spec->catdir('t', 'lib');
48b349
 use Test::More;
48b349
@@ -208,7 +209,15 @@ SKIP: {
48b349
 
48b349
     like($abs_path,      qr|$want$|i, "Cwd::abs_path produced $abs_path");
48b349
     like($fast_abs_path, qr|$want$|i, "Cwd::fast_abs_path produced $fast_abs_path");
48b349
-    like($pas,           qr|$want$|i, "Cwd::_perl_abs_path produced $pas") if $EXTRA_ABSPATH_TESTS;
48b349
+    if ($EXTRA_ABSPATH_TESTS) {
48b349
+        # _perl_abs_path() can fail if some ancestor directory isn't readable
48b349
+        if (defined $pas) {
48b349
+            like($pas,           qr|$want$|i, "Cwd::_perl_abs_path produced $pas");
48b349
+        }
48b349
+        else {
48b349
+            is($!+0, EACCES, "check we got the expected error on failure");
48b349
+        }
48b349
+    }
48b349
 
48b349
     rmtree($test_dirs[0], 0, 0);
48b349
     1 while unlink $file;
48b349
diff --git a/t/cwd_enoent.t b/t/cwd_enoent.t
48b349
index 8f3a1fb..510c65e 100644
48b349
--- a/t/cwd_enoent.t
48b349
+++ b/t/cwd_enoent.t
48b349
@@ -2,7 +2,7 @@ use warnings;
48b349
 use strict;
48b349
 
48b349
 use Config;
48b349
-use Errno qw(ENOENT);
48b349
+use Errno qw();
48b349
 use File::Temp qw(tempdir);
48b349
 use Test::More;
48b349
 
48b349
@@ -19,6 +19,7 @@ unless(mkdir("$tmp/testdir") && chdir("$tmp/testdir") && rmdir("$tmp/testdir")){
48b349
 plan tests => 8;
48b349
 require Cwd;
48b349
 
48b349
+my @acceptable_errnos = (&Errno::ENOENT, (defined &Errno::ESTALE ? &Errno::ESTALE : ()));
48b349
 foreach my $type (qw(regular perl)) {
48b349
     SKIP: {
48b349
 	skip "_perl_abs_path() not expected to work", 4
48b349
@@ -36,12 +37,14 @@ foreach my $type (qw(regular perl)) {
48b349
 	$res = Cwd::getcwd();
48b349
 	$eno = 0+$!;
48b349
 	is $res, undef, "$type getcwd result on non-existent directory";
48b349
-	is $eno, ENOENT, "$type getcwd errno on non-existent directory";
48b349
+	ok((grep { $eno == $_ } @acceptable_errnos), "$type getcwd errno on non-existent directory")
48b349
+	    or diag "Got errno code $eno, expected " . join(", ", @acceptable_errnos);
48b349
 	$! = 0;
48b349
 	$res = Cwd::abs_path(".");
48b349
 	$eno = 0+$!;
48b349
 	is $res, undef, "$type abs_path result on non-existent directory";
48b349
-	is $eno, ENOENT, "$type abs_path errno on non-existent directory";
48b349
+	ok((grep { $eno == $_ } @acceptable_errnos), "$type abs_path errno on non-existent directory")
48b349
+	    or diag "Got errno code $eno, expected " . join(", ", @acceptable_errnos);
48b349
     }
48b349
 }
48b349
 
48b349
-- 
48b349
2.20.1
48b349