[libdist-zilla-role-bootstrap-perl] 16/19: Bugfix: attempt to resolve path differences when tempdirs are behind symlinks.
Axel Beckert
abe at deuxchevaux.org
Sat Aug 8 11:58:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to annotated tag 0.2.1-source
in repository libdist-zilla-role-bootstrap-perl.
commit bff08da33802840ae8ef715223f62a8e94575e0a
Author: Kent Fredric <kentfredric at gmail.com>
Date: Tue Sep 24 14:28:39 2013 +1200
Bugfix: attempt to resolve path differences when tempdirs are behind symlinks.
This is mostly just using more ->realpath.
This was previously a problem, because:
my $path = Path::Tiny->tempdir;
chdir $path->stringify;
path('./') != $path
Because on darwin
$path
May be
/var/foo/bar/<>
and
/var
May be a symlink to
/private/var/
So that when somebody calls
cwd()
inside
/var
You get
/private/var/
---
Changes | 3 +++
README.mkdn | 2 +-
lib/Dist/Zilla/Role/Bootstrap.pm | 3 +--
t/01-basic.t | 10 +++++-----
t/02-try-built-mtime.t | 12 ++++++------
t/03-try-built-parseversion.t | 10 +++++-----
6 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/Changes b/Changes
index 510f9f0..7930f81 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,9 @@
Release history for Dist-Zilla-Role-Bootstrap
{{$NEXT}}
+ [Bugfix]
+ - use ->realpath for comparisons to avoid symlink confusion on darwin
+ - use $zilla->root instead of calling cwd()
0.2.0 2013-09-21T12:39:54Z
[00 Major - try_built_method]
diff --git a/README.mkdn b/README.mkdn
index 99eaeb6..7111755 100644
--- a/README.mkdn
+++ b/README.mkdn
@@ -4,7 +4,7 @@ Dist::Zilla::Role::Bootstrap - Shared logic for bootstrap things.
# VERSION
-version 0.2.0
+version 0.2.1
# SYNOPSIS
diff --git a/lib/Dist/Zilla/Role/Bootstrap.pm b/lib/Dist/Zilla/Role/Bootstrap.pm
index 9df9194..33a7b9f 100644
--- a/lib/Dist/Zilla/Role/Bootstrap.pm
+++ b/lib/Dist/Zilla/Role/Bootstrap.pm
@@ -115,8 +115,7 @@ has _cwd => (
lazy => 1,
builder => sub {
require Path::Tiny;
- require Cwd;
- return Path::Tiny::path( Cwd::cwd() );
+ return Path::Tiny::path( $_[0]->zilla->root );
},
);
diff --git a/t/01-basic.t b/t/01-basic.t
index 1c718b4..396d7f4 100644
--- a/t/01-basic.t
+++ b/t/01-basic.t
@@ -60,11 +60,11 @@ is_deeply(
'dump_config is expected'
);
-is( $instance->distname, 'Example', 'distname is Example' );
-is( $instance->_cwd, $scratch, 'cwd is project root/' );
-is( $instance->try_built, undef, 'try_built is off' );
-is( $instance->fallback, 1, 'fallback is on' );
-is( $instance->_bootstrap_root, $scratch, '_bootstrap_root == _cwd' );
+is( $instance->distname, 'Example', 'distname is Example' );
+is( $instance->_cwd->realpath, $scratch->realpath, 'cwd is project root/' );
+is( $instance->try_built, undef, 'try_built is off' );
+is( $instance->fallback, 1, 'fallback is on' );
+is( $instance->_bootstrap_root, $scratch, '_bootstrap_root == _cwd' );
ok( $instance->can('_add_inc'), '_add_inc method exists' );
done_testing;
diff --git a/t/02-try-built-mtime.t b/t/02-try-built-mtime.t
index 34b1f79..f8cf6f8 100644
--- a/t/02-try-built-mtime.t
+++ b/t/02-try-built-mtime.t
@@ -78,12 +78,12 @@ is_deeply(
'dump_config is expected'
);
-is( $instance->distname, 'Example', 'distname is Example' );
-is( $instance->_cwd, $scratch, 'cwd is project root/' );
-is( $instance->try_built, 1, 'try_built is on' );
-is( $instance->try_built_method, 'mtime', 'try_built_method is mtime' );
-is( $instance->fallback, 1, 'fallback is on' );
-is( $instance->_bootstrap_root, $scratch->child('Example-0.05'), '_bootstrap_root == _cwd' );
+is( $instance->distname, 'Example', 'distname is Example' );
+is( $instance->_cwd->realpath, $scratch->realpath, 'cwd is project root/' );
+is( $instance->try_built, 1, 'try_built is on' );
+is( $instance->try_built_method, 'mtime', 'try_built_method is mtime' );
+is( $instance->fallback, 1, 'fallback is on' );
+is( $instance->_bootstrap_root->realpath, $scratch->child('Example-0.05')->realpath, '_bootstrap_root == _cwd' );
ok( $instance->can('_add_inc'), '_add_inc method exists' );
chdir $cwd->stringify;
diff --git a/t/03-try-built-parseversion.t b/t/03-try-built-parseversion.t
index 9ed6800..f443e2b 100644
--- a/t/03-try-built-parseversion.t
+++ b/t/03-try-built-parseversion.t
@@ -76,13 +76,13 @@ is_deeply(
'dump_config is expected'
);
-is( $instance->distname, 'Example', 'distname is Example' );
-is( $instance->_cwd, $scratch, 'cwd is project root/' );
-is( $instance->try_built, 1, 'try_built is on' );
-is( $instance->try_built_method, 'parseversion', 'try_built_method is parseversion' );
+is( $instance->distname, 'Example', 'distname is Example' );
+is( $instance->_cwd->realpath, $scratch->realpath, 'cwd is project root/' );
+is( $instance->try_built, 1, 'try_built is on' );
+is( $instance->try_built_method, 'parseversion', 'try_built_method is parseversion' );
is( $instance->fallback, 1, 'fallback is on' );
-is( $instance->_bootstrap_root, $scratch->child('Example-0.10'), '_bootstrap_root == _cwd' );
+is( $instance->_bootstrap_root->realpath, $scratch->child('Example-0.10')->realpath, '_bootstrap_root == _cwd' );
ok( $instance->can('_add_inc'), '_add_inc method exists' );
chdir $cwd->stringify;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-role-bootstrap-perl.git
More information about the Pkg-perl-cvs-commits
mailing list