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