bug-stow
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in cleanup_invalid_links


From: Sam Lunt
Subject: Bug in cleanup_invalid_links
Date: Tue, 1 Sep 2020 23:01:50 -0500

Hello,

I found a bug in the cleanup_invalid_links subroutine that leads to a
spurious warning being printed when the directory has a broken symlink
containing an absolute path. The issue is with these lines (1032-1033
on my system):
    not -e join_paths($dir, $source) and # bad link
    $self->path_owned_by_package($node_path, $source) # owned by stow

The bug can be recreated using the following steps (/x/y/z can be
replaced with any non-existent absolute path):
    $ mkdir /tmp/stow_bug
    $ mkdir /tmp/stow_bug/packages
    $ mkdir /tmp/stow_bug/packages/p1
    $ ln -s /x/y/z /tmp/stow_bug/xyz
    $ cd /tmp/stow_bug/packages
    $ stow -D p1

This will print the error message:
    BUG in find_stowed_path? Absolute/relative mismatch between Stow
dir packages and path /x/y/z at /usr/share/perl5/vendor_perl/Stow.pm
line 966, line 22.

I think that when $source is an absolute path, the entire check can be
skipped, since a symlink containing an absolute path could never be a
stale Stow link.

I think it's probably sufficient to change the lines 1032-33 from above to be:
    substr($source, 0, 1) ne '/' and # path is relative
    not -e join_paths($dir, $source) and # bad link
    $self->path_owned_by_package($node_path, $source) # owned by stow

Best,
Sam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]