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