Commit graph

62 commits

Author SHA1 Message Date
Adam Spiers
541faf68eb cleanup_invalid_links: improve docs 2024-03-31 12:16:42 +01:00
Adam Spiers
a2beb7b371 Separate treatment of .stow and .nonstow marked dirs
Placing a .stow file in a directory tells Stow that this directory
should be considered a Stow directory.  This is already
well-documented.

There was an undocumented and slightly broken feature where placing a
.nonstow file in a directory was treated in exactly the same way.  The
intention was for .nonstow to cause Stow to skip stowing into and
unstowing from that directory and any of its descendants.  However, it
also caused Stow to consider symlinks into any of those directories as
owned by Stow, even though that was clearly not the intention.  So
separate treatment of .stow and .nonstow markers, so that while both
provide protection against Stow stowing and unstowing, only .stow
affects the symlink ownership logic in find_stowed_path() and
marked_stow_dir().

Probably no one uses the undocumented .nonstow feature, so it may make
sense to remove this in future.
2024-03-31 12:15:53 +01:00
Adam Spiers
287d8016f6 join_paths: improve docs to clarify purpose / differences
join_paths() is used in specific ways and has specific behaviour
required which is nuanced and not obvious at first sight.  So make
this explicit for future reference.
2024-03-31 12:04:09 +01:00
Adam Spiers
4d711fc4ac Make join_paths correctly handle absolute paths
Previously join_paths() was incorrectly handling absolute paths, for
example join_paths('a/b', '/c/d') would return 'a/b/c/d' rather than
'/c/d'.  This was a problem when following a symlink in
find_stowed_path(), because if the symlink was not owned by Stow and
pointed to an absolute path, find_stowed_path() might accidentally
deem the link owned by Stow, if c/d was a valid path relative to the
current directory.
2024-03-31 12:02:58 +01:00
Adam Spiers
d1480195b6 Move setting of cperl-indent-level to .dir-locals.el
This removes duplication.
2024-03-31 12:02:58 +01:00
Adam Spiers
9db0de3005 Add some helpful comments
Explain a few things in preparation for a bugfix.
2024-03-10 17:40:17 +00:00
Adam Spiers
9ce37d9575 Remove $stow_path parameter from unstow_{contents,node}{,_orig}()
Unlike with the stow_{contents,node}{,_orig}() counterpart functions,
when unstowing, it's not necessary to pass the $stow_path parameter
because it can never differ from $self->{stow_path}.

The stow_*() functions need this for the corner case of unfolding a
tree which is stowed from a different stow directory to the one being
used for the current stowing operation (see the "Multiple Stow
Directories" section of the manual).
2024-03-09 17:57:04 +00:00
Adam Spiers
4e2776224f Tweak text of error and debug messages 2024-03-09 17:57:04 +00:00
Adam Spiers
b7bf77da52 Add a missing period to the stow_contents() comments. 2024-03-09 17:57:04 +00:00
Adam Spiers
72084f6fec Add a comment explaining that $node_target can be adjusted for dot- prefix 2024-03-09 17:57:04 +00:00
Adam Spiers
a3700e7171 Add a comment explaining path in stow_contents() 2024-03-09 17:57:04 +00:00
Adam Spiers
20bee7428e Add a comment explaining $stow_path parameter of stow_contents()
At first sight this parameter looks redundant since we have
$self->{stow_path}, but in one case the value can differ from that,
so mention that explicitly.
2024-03-09 17:57:04 +00:00
Adam Spiers
f51fc1248c plan_*: rename $path to $pkg_path for clarity
$path is a vague variable name.
2024-03-09 17:57:04 +00:00
Adam Spiers
cb4b0c6a9a Remove trailing whitespace 2024-03-09 17:56:41 +00:00
Adam Spiers
ee240c5bf2 cleanup_invalid_links: it's a bug if called with a non-directory 2021-04-15 15:11:30 +01:00
Adam Spiers
e76dda400a Skip unnecessary planning 2021-04-15 15:11:30 +01:00
Adam Spiers
c0c01a6c61 cleanup_invalid_links: improve handling of scheduled actions 2021-04-15 15:11:30 +01:00
Adam Spiers
208f383580 Further improve debug output 2021-04-15 15:11:30 +01:00
Adam Spiers
396357dc67 Rename path_owned_by_package() to link_owned_by_package() 2021-04-15 15:11:30 +01:00
Adam Spiers
832135e269 Make cleanup_invalid_links() more explicit
And add some debug.
2021-04-15 15:11:30 +01:00
Adam Spiers
86f4694d96 Improve debug indent levels 2021-04-15 15:11:30 +01:00
Adam Spiers
90278f854c Move to explicit debug indentation levels 2021-04-15 15:11:30 +01:00
Adam Spiers
8d7b7a7310 foldable(): fix debug indentation 2021-04-15 15:11:30 +01:00
Adam Spiers
9f4f8185ac should_skip_target_which_is_stow_dir(): fix debug indentation 2021-04-15 15:11:30 +01:00
Adam Spiers
40a0807185 Check that find_stowed_path $path matches relative/absolute with target
Watch out for a corner case probably only relevant in tests.
2019-06-28 15:24:50 +01:00
Adam Spiers
3270b145e1 Improve comments on function parameters for clarity 2019-06-28 15:24:50 +01:00
Adam Spiers
27796720d5 Upgrade to GPL v3 and add headers to files (#44)
Following advice from maintainers@gnu.org, bring Stow in line with
other GNU projects by upgrading it from GPL v2 to v3

  https://www.gnu.org/prep/maintain/html_node/Licensing-of-GNU-Packages.html#Licensing-of-GNU-Packages

as obtained in plain text and texinfo formats from

  https://www.gnu.org/licenses/

and adding appropriate headers:

  https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Code.html#License-Notices-for-Code

Fixes #44: https://github.com/aspiers/stow/issues/44
2019-06-27 20:37:40 +01:00
Adam Spiers
72ef83cebd Fix old descriptions of Stow (#22)
De-emphasise the package management aspects, since these days
almost everyone prefers to use modern package managers such as
rpm / dpkg / Nix for (system-wide) package management.

Also include more popular modern use cases for Stow such as management
of dotfiles and software compiled in the user's $HOME directory.

Fixes #22: https://github.com/aspiers/stow/issues/22
2019-06-25 16:52:33 +01:00
Adam Spiers
1b320b1dc3 Merge pull request #17 from jvkersch/enh/dot-files
Special processing for dotfiles
2016-10-05 17:47:51 +01:00
Joris Vankerschaver
182acbbb64 Special processing for dotfiles 2016-10-04 17:51:01 +01:00
Adam Spiers
f5e12670d6 remove superfluous space in function call
Be consistent with style elsewhere.
2016-08-23 10:37:12 +01:00
Adam Spiers
43333b8eca add Stow/Util.pm.in with @VERSION@ substitution
This is now necessary in order to prevent pause.perl.org from
complaining:

    Status: Decreasing version number
    =================================

         module : Stow::Util
         version: undef
         in file: lib/Stow/Util.pm
         status : Not indexed because lib/Stow/Util.pm in
                 A/AS/ASPIERS/Stow-v2.2.0.tar.gz has a higher version number
                 (0)
2015-11-09 12:36:51 +00:00
Adam Spiers
7b43622dd9 fix stowing of relative links when --no-folding is used
With a tree like this:

    .
    |-- stow
    |   `-- pkg
    |       `-- lib
    |           |-- itk-current -> itk4.0.0
    |           `-- itk4.0.0
    |               `-- libitk4.0.0.so
    `-- target
        `-- lib
            |-- itk4.0.0 -> ../../stow/pkg/lib/itk4.0.0
            `-- libfoo-1.2.3.so

stowing pkg with the --no-folding option resulted in itk-current
being "unpacked":

    .
    `-- target
        `-- lib
            |-- itk-current
            |   `-- libitk4.0.0.so -> ../../../stow/pkg/lib/itk-current/libitk4.0.0.so
            |-- itk4.0.0
            |   `-- libitk4.0.0.so -> ../../../stow/pkg/lib/itk4.0.0/libitk4.0.0.so
            `-- libfoo-1.2.3.so

This commit fixes it so that it gets stowed as a symlink:

  .
  `-- target
      `-- lib
          ...
          |-- itk-current -> ../../stow/pkg/lib/itk-current
          ...

Thanks to Gabriele Balducci for reporting this problem:

    http://thread.gmane.org/gmane.comp.gnu.stow.general/6676
2015-01-01 19:02:46 +00:00
Adam Spiers
5be496a795 improve debug 2015-01-01 19:02:26 +00:00
Adam Spiers
07a84541f1 make it more obvious when target (sub)directory is skipped
This should avoid the sort of confusion seen in:

  https://github.com/aspiers/shell-env/issues/1
2014-09-23 01:37:54 +01:00
Adam Spiers
d788ce0c1c avoid precedence warning
With Perl 5.20, installing a package with stow gives a warning like
this:

  Possible precedence issue with control flow operator at
  /gar/packages/stow-2.2.0/lib/perl5/site_perl/5.20.0/Stow.pm line 1736.

http://lists.gnu.org/archive/html/bug-stow/2014-06/msg00000.html

Suggested-by: Adam Sampson <ats@offog.org>
2014-06-16 10:22:55 +01:00
Adam Spiers
c500216f20 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
2013-04-12 17:48:08 +01:00
Adam Spiers
8ccef07601 Only include $! in error messages for failed syscalls. 2012-07-09 01:06:13 +01:00
Adam Spiers
1517384e53 Improve docs for path_owned_by_package() 2012-02-19 11:58:45 +00:00
Adam Spiers
ed12c787df Add --no-folding option. 2012-02-18 20:33:34 +00:00
Adam Spiers
a127d22457 Improve error message when package is not found. 2012-02-18 20:33:34 +00:00
Adam Spiers
a5c2134f59 Add missing options to pod, and reference to front-end documentation. 2012-02-18 17:14:50 +00:00
Adam Spiers
fe18b6c442 Avoid "Use of uninitialized value" warnings from test suite.
Happened on some versions of Perl when TEST_VERBOSE not yet.
Thanks Adam Sampson!
2012-01-13 11:35:53 +00:00
Adam Spiers
8357dca645 Remove "There are no outstanding operations to perform" warning.
This is more in keeping with the UNIX convention of no output on success,
and is also the way Stow v1.x behaved.  Thanks to Adam Sampson for the suggestion.
2012-01-11 14:01:40 +00:00
Adam Spiers
7e44666640 Add --adopt / -a option. 2012-01-09 21:29:34 +00:00
Adam Spiers
5110ea8338 Add stacktrace to internal error report to aid debugging. 2012-01-09 21:11:58 +00:00
Adam Spiers
1200420687 Link to website to encourage users to report bugs. 2012-01-09 17:52:11 +00:00
Adam Spiers
1efb786140 Improve existing comments. 2012-01-09 16:25:27 +00:00
Adam Spiers
d672e3e6cf Improve debug levels. 2011-11-26 19:18:33 +00:00
Adam Spiers
d5aa061abe Fix documentation regarding splitting of symlinks across multiple stow directories. 2011-11-26 16:34:57 +00:00