aspiers / aspiers/stow

find_stow_path returns name of stow directory not name of package

Open
#2 4 comments 0 reactions 1 assignee Claimed by @aspiers View on GitHub
enhancement
Dominant language
Perl
Stars
1.1k
Forks
56
PR merge metrics
No merged PRs in 30d

Description

Once /usr/local/stow starts filling up with packages, it is useful to organize packages into categories under /usr/local/stow, eg Audio, Desktop, Utilities, Video etc

If packages under these sub-directories, which of course should get marked as being STOW directories with the presence of a .stow file, contain common target directories, then these should be folded/unfolded as appropriate on stowing and unstowing.

However when find_stow_path is called with the path to a target link to be changed in a sub-directory, it returns the name of the package as just the sub-directory category name eg Audio, or Desktop or whatever and not the category plus package name relative to the top stow directory. Of cours unlinking/mkdir then fails because the combined full stow path is wrong as it does not contain the actual package name and thus does not exist, causing stow to exist with the error message that it was called with non-directory path.

This is rectified with the following patch to Stow.pm for find_stow_path

```
--- Stow.pm.ORIG 2014-10-28 21:02:46.397092559 +0100
+++ Stow.pm 2014-10-28 21:02:46.397092559 +0100
@@ -911,7 +911,7 @@
if $i == $#path;

debug(4, " yes - $dir was marked as a stow dir");
- my $package = $path[$i + 1];
+ my $package = "$path[$i + 1]/$path[$i + 2]";
return ($path, $dir, $package);
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.