Problem was that when running stow_contents/unstow_contents recursively from
stow_node/unstow_node the information for the source path (without the dot- to
. transformation) was lost.

In the case of stow_contents the solution is just to remove the leading
dots (..) from the $source path (since the $source path is passed as an argument
to the function)

In the case of unstow_contents the solution is the same as for stow_contents but
the arguments was now passed so I added it to the function.
This commit is contained in:
ATuinDev 2020-05-24 18:12:49 +02:00
parent 9fd3624a75
commit d4e413536e
No known key found for this signature in database
GPG key ID: 30B13E03CCAB58B7

View file

@ -284,6 +284,7 @@ sub plan_unstow {
$self->{stow_path},
$package,
'.',
$path,
);
}
debug(2, "Planning unstow of package $package... done");
@ -369,7 +370,8 @@ sub stow_contents {
my $self = shift;
my ($stow_path, $package, $target, $source) = @_;
my $path = join_paths($stow_path, $package, $target);
# Remove leading .. from $source
my $path = join '/', map { ($_ eq '..') ? ( ) : $_ } (split m{/+}, $source);
return if $self->should_skip_target_which_is_stow_dir($target);
@ -740,9 +742,10 @@ sub unstow_node_orig {
#============================================================================
sub unstow_contents {
my $self = shift;
my ($stow_path, $package, $target) = @_;
my ($stow_path, $package, $target, $source) = @_;
my $path = join_paths($stow_path, $package, $target);
# Remove leading .. from $source
my $path = join '/', map { ($_ eq '..') ? ( ) : $_ } (split m{/+}, $source);
return if $self->should_skip_target_which_is_stow_dir($target);
@ -778,7 +781,7 @@ sub unstow_contents {
$node_target = $adj_node_target;
}
$self->unstow_node($stow_path, $package, $node_target);
$self->unstow_node($stow_path, $package, $node_target, join_paths($source, $node));
}
if (-d $target) {
$self->cleanup_invalid_links($target);
@ -798,7 +801,7 @@ sub unstow_contents {
#============================================================================
sub unstow_node {
my $self = shift;
my ($stow_path, $package, $target) = @_;
my ($stow_path, $package, $target, $source) = @_;
my $path = join_paths($stow_path, $package, $target);
@ -872,7 +875,7 @@ sub unstow_node {
elsif (-e $target) {
debug(4, " Evaluate existing node: $target");
if (-d $target) {
$self->unstow_contents($stow_path, $package, $target);
$self->unstow_contents($stow_path, $package, $target, $source);
# This action may have made the parent directory foldable
if (my $parent = $self->foldable($target)) {