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