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