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