summaryrefslogtreecommitdiff
path: root/lib/Stow.pm.in
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2013-04-12 17:47:29 +0100
committerAdam Spiers <stow@adamspiers.org>2013-04-12 17:48:08 +0100
commitc500216f20b081fae0799253d1d86536d48ff6ba (patch)
treecba17ae235204888c9cc88233d5a3be04ee71816 /lib/Stow.pm.in
parentfe5b65880327ec823ce425f3ed3313733193b665 (diff)
downloadstow-c500216f20b081fae0799253d1d86536d48ff6ba.tar.gz
correctly handle the stow/target directories as non-canonical paths
Fix the case discovered by Hiroyuki Iwatsuki where stowing fails if the stow / target directories are non-canonical paths. For example, on FreeBSD /home is a symlink pointing to 'usr/home', so running with the stow directory as /home/user/local/stow and the target directory as /home/user/local previously resulted in the stow directory path being calculated as ../../../usr/home/user/local/stow relative to the target. http://article.gmane.org/gmane.comp.gnu.stow.bugs/8820
Diffstat (limited to 'lib/Stow.pm.in')
-rwxr-xr-xlib/Stow.pm.in6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Stow.pm.in b/lib/Stow.pm.in
index 931740f..98ecf35 100755
--- a/lib/Stow.pm.in
+++ b/lib/Stow.pm.in
@@ -185,11 +185,11 @@ sub set_stow_dir {
}
my $stow_dir = canon_path($self->{dir});
-
- $self->{stow_path} = File::Spec->abs2rel($stow_dir, $self->{target});
+ my $target = canon_path($self->{target});
+ $self->{stow_path} = File::Spec->abs2rel($stow_dir, $target);
debug(2, "stow dir is $stow_dir");
- debug(2, "stow dir path relative to target $self->{target} is $self->{stow_path}");
+ debug(2, "stow dir path relative to target $target is $self->{stow_path}");
}
sub init_state {