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