summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Spiers <stow@adamspiers.org>2019-06-28 15:22:44 +0100
committerAdam Spiers <stow@adamspiers.org>2019-06-28 15:24:50 +0100
commit40a0807185054a47cdd022fd36f0d44fc1bab9dd (patch)
tree708ad446a4a347131cf2638e7e93ed590812fd54
parent3270b145e12b507f972ddddc5b167c228bb0893b (diff)
downloadstow-40a0807185054a47cdd022fd36f0d44fc1bab9dd.tar.gz
Check that find_stowed_path $path matches relative/absolute with target
Watch out for a corner case probably only relevant in tests.
-rwxr-xr-xlib/Stow.pm.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Stow.pm.in b/lib/Stow.pm.in
index 643ed89..77f67b3 100755
--- a/lib/Stow.pm.in
+++ b/lib/Stow.pm.in
@@ -961,6 +961,12 @@ sub find_stowed_path {
# If no .stow file was found, we need to find out whether it's
# owned by the current stow directory, in which case $path will be
# a prefix of $self->{stow_path}.
+ if (substr($path, 0, 1) eq '/' xor substr($self->{stow_path}, 0, 1) eq '/')
+ {
+ warn "BUG in find_stowed_path? Absolute/relative mismatch between " .
+ "Stow dir $self->{stow_path} and path $path";
+ }
+
my @stow_path = split m{/+}, $self->{stow_path};
# Strip off common prefixes until one is empty