summaryrefslogtreecommitdiff
path: root/dist/PathTools
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2020-10-07 11:50:55 +1100
committerTony Cook <tony@develop-help.com>2020-12-01 15:29:33 +1100
commit12a8085aee9a1a5ac613205b43ea06406736ac6b (patch)
tree74c23d485178fe9cb995fbb2c5e564c72d22449c /dist/PathTools
parente935ef333b3eab54a766de93fad1369f76ddea49 (diff)
downloadperl-12a8085aee9a1a5ac613205b43ea06406736ac6b.tar.gz
PathTools: use PerlLIO_*() functions and chdir() on a symlink differences
Use PerlLIO_lstat() and PerlLIO_readlink() instead of directly calling the POSIX names, so our Win32 overrides work. For the test, unlike POSIX, changing directory via a symlink on Win32 appears to store the symlink as part of the current directory rather so GetCurrentDirectory() fetches that rather than the hardlinked path.
Diffstat (limited to 'dist/PathTools')
-rw-r--r--dist/PathTools/Cwd.pm2
-rw-r--r--dist/PathTools/Cwd.xs9
-rw-r--r--dist/PathTools/lib/File/Spec.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/AmigaOS.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Cygwin.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Epoc.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Functions.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Mac.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/OS2.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Unix.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/VMS.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Win32.pm2
-rw-r--r--dist/PathTools/t/cwd.t4
13 files changed, 21 insertions, 14 deletions
diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
index ce0f25f72d..6a1d2f17ee 100644
--- a/dist/PathTools/Cwd.pm
+++ b/dist/PathTools/Cwd.pm
@@ -3,7 +3,7 @@ use strict;
use Exporter;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
my $xs_version = $VERSION;
$VERSION =~ tr/_//d;
diff --git a/dist/PathTools/Cwd.xs b/dist/PathTools/Cwd.xs
index e7ecb3c6c1..223e1a6b18 100644
--- a/dist/PathTools/Cwd.xs
+++ b/dist/PathTools/Cwd.xs
@@ -84,6 +84,9 @@ bsd_realpath(const char *path, char resolved[MAXPATHLEN])
unsigned symlinks;
int serrno;
char remaining[MAXPATHLEN], next_token[MAXPATHLEN];
+#ifdef PERL_IMPLICIT_SYS
+ dTHX;
+#endif
serrno = errno;
symlinks = 0;
@@ -175,8 +178,8 @@ bsd_realpath(const char *path, char resolved[MAXPATHLEN])
}
#if defined(HAS_LSTAT) && defined(HAS_READLINK) && defined(HAS_SYMLINK)
{
- struct stat sb;
- if (lstat(resolved, &sb) != 0) {
+ Stat_t sb;
+ if (PerlLIO_lstat(resolved, &sb) != 0) {
if (errno == ENOENT && p == NULL) {
errno = serrno;
return (resolved);
@@ -191,7 +194,7 @@ bsd_realpath(const char *path, char resolved[MAXPATHLEN])
errno = ELOOP;
return (NULL);
}
- slen = readlink(resolved, symlink, sizeof(symlink) - 1);
+ slen = PerlLIO_readlink(resolved, symlink, sizeof(symlink) - 1);
if (slen < 0)
return (NULL);
symlink[slen] = '\0';
diff --git a/dist/PathTools/lib/File/Spec.pm b/dist/PathTools/lib/File/Spec.pm
index 732746d943..30d883b61b 100644
--- a/dist/PathTools/lib/File/Spec.pm
+++ b/dist/PathTools/lib/File/Spec.pm
@@ -2,7 +2,7 @@ package File::Spec;
use strict;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
my %module = (
diff --git a/dist/PathTools/lib/File/Spec/AmigaOS.pm b/dist/PathTools/lib/File/Spec/AmigaOS.pm
index 0d3c9a5770..fd9da81cdf 100644
--- a/dist/PathTools/lib/File/Spec/AmigaOS.pm
+++ b/dist/PathTools/lib/File/Spec/AmigaOS.pm
@@ -3,7 +3,7 @@ package File::Spec::AmigaOS;
use strict;
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Cygwin.pm b/dist/PathTools/lib/File/Spec/Cygwin.pm
index 591af63f97..953c23361a 100644
--- a/dist/PathTools/lib/File/Spec/Cygwin.pm
+++ b/dist/PathTools/lib/File/Spec/Cygwin.pm
@@ -3,7 +3,7 @@ package File::Spec::Cygwin;
use strict;
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Epoc.pm b/dist/PathTools/lib/File/Spec/Epoc.pm
index 4b8a17fc17..fcb9e894e3 100644
--- a/dist/PathTools/lib/File/Spec/Epoc.pm
+++ b/dist/PathTools/lib/File/Spec/Epoc.pm
@@ -2,7 +2,7 @@ package File::Spec::Epoc;
use strict;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
require File::Spec::Unix;
diff --git a/dist/PathTools/lib/File/Spec/Functions.pm b/dist/PathTools/lib/File/Spec/Functions.pm
index fda2e95c62..e14ad2f745 100644
--- a/dist/PathTools/lib/File/Spec/Functions.pm
+++ b/dist/PathTools/lib/File/Spec/Functions.pm
@@ -3,7 +3,7 @@ package File::Spec::Functions;
use File::Spec;
use strict;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
require Exporter;
diff --git a/dist/PathTools/lib/File/Spec/Mac.pm b/dist/PathTools/lib/File/Spec/Mac.pm
index 504d0cef74..8026edcb12 100644
--- a/dist/PathTools/lib/File/Spec/Mac.pm
+++ b/dist/PathTools/lib/File/Spec/Mac.pm
@@ -4,7 +4,7 @@ use strict;
use Cwd ();
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/OS2.pm b/dist/PathTools/lib/File/Spec/OS2.pm
index fd7bc7fd04..3c35ba99b4 100644
--- a/dist/PathTools/lib/File/Spec/OS2.pm
+++ b/dist/PathTools/lib/File/Spec/OS2.pm
@@ -4,7 +4,7 @@ use strict;
use Cwd ();
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Unix.pm b/dist/PathTools/lib/File/Spec/Unix.pm
index 2221587115..c06d18f468 100644
--- a/dist/PathTools/lib/File/Spec/Unix.pm
+++ b/dist/PathTools/lib/File/Spec/Unix.pm
@@ -3,7 +3,7 @@ package File::Spec::Unix;
use strict;
use Cwd ();
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
=head1 NAME
diff --git a/dist/PathTools/lib/File/Spec/VMS.pm b/dist/PathTools/lib/File/Spec/VMS.pm
index 174dd22b2e..9b78c8b4bc 100644
--- a/dist/PathTools/lib/File/Spec/VMS.pm
+++ b/dist/PathTools/lib/File/Spec/VMS.pm
@@ -4,7 +4,7 @@ use strict;
use Cwd ();
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Win32.pm b/dist/PathTools/lib/File/Spec/Win32.pm
index a3b89c3ff6..1537442023 100644
--- a/dist/PathTools/lib/File/Spec/Win32.pm
+++ b/dist/PathTools/lib/File/Spec/Win32.pm
@@ -5,7 +5,7 @@ use strict;
use Cwd ();
require File::Spec::Unix;
-our $VERSION = '3.79';
+our $VERSION = '3.80';
$VERSION =~ tr/_//d;
our @ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/t/cwd.t b/dist/PathTools/t/cwd.t
index c05693880e..d155e33255 100644
--- a/dist/PathTools/t/cwd.t
+++ b/dist/PathTools/t/cwd.t
@@ -187,6 +187,10 @@ rmtree($test_dirs[0], 0, 0);
SKIP: {
skip "no symlinks on this platform", 2+$EXTRA_ABSPATH_TESTS unless $Config{d_symlink} && $^O !~ m!^(qnx|nto)!;
+ # on Win32 GetCurrentDirectory() includes the symlink if
+ # you chdir() to a path including the symlink.
+ skip "Win32 symlinks are unusual", 2+$EXTRA_ABSPATH_TESTS if $^O eq "MSWin32";
+
my $file = "linktest";
mkpath([$Test_Dir], 0, 0777);
symlink $Test_Dir, $file;