Stow a absolute symlink
Kamilcuk opened this issue · 3 comments
Stow doesn't want to stow absolute symlinks because of this code. Why?
To reproduce:
$ mkdir -p /tmp/temp/stow ; cd /tmp/temp/stow
$ mkdir pkg
$ ln -s /run/systemd/resolve/resolv.conf pkg/resolv.conf
$ stow -t /tmp/temp -d . -S pkg
WARNING! stowing pkg would cause conflicts:
* source is an absolute symlink stow/pkg/resolv.conf => /run/systemd/resolve/resolv.conf
All operations aborted.
$ find /tmp/temp '!' -type d -printf "%p -> %l\n"
/tmp/temp/stow/pkg/resolv.conf -> /run/systemd/resolve/resolv.conf
Well, I can create a temporary directory with this absolute link and make the stow-ed link relative to that link, like:
$ cd /tmp/temp/stow
$ mkdir -p /tmp/temp/stow/somedir
$ ln -s /run/systemd/resolve/resolv.conf somedir/resolv.conf
$ ln -sf ../somedir/resolv.conf pkg/resolv.conf
$ stow -t /tmp/temp -d . -v -S pkg
LINK: resolv.conf => stow/pkg/resolv.conf
$ find /tmp/temp '!' -type d -printf "%p -> %l\n"
/tmp/temp/resolv.conf -> stow/pkg/resolv.conf
/tmp/temp/stow/stupid/resolv.conf -> /run/systemd/resolve/resolv.conf
/tmp/temp/stow/pkg/resolv.conf -> ../stupid/resolv.conf
but that looks strange as it requires a temporary directory that does nothing really. Alternatively a directory may be added with the absolute symlink, relative symlink to that directory and that directory is listed in --ignore
rules.
Is there specific reason why absolute symlinks from stow directory can't be stow-ed? If so, is a symlink to an absolute symlink going to cause any harm? Why care and not just stow a symlink to that absolute symlink just as-if it would be a file?
Another alternative is making my symlink relative to repo location, like ln -s ../../../../constant_count_of_../../../run/systemd/resolve/resolv.conf
, but that's assuming I will clone my repo to the same dir.
I tried searching/reading https://lists.gnu.org/archive/html/stow-devel/2009-11/msg00000.html and the issues here, but didn't find anything, I would appreciate some pointers.
Yeah, this is a known limitation and I think this issue is a duplicate of #51 - does that sound right to you?
See also #65 (comment).
Is there specific reason why absolute symlinks from stow directory can't be stow-ed? If so, is a symlink to an absolute symlink going to cause any harm? Why care and not just stow a symlink to that absolute symlink just as-if it would be a file?
I think the simple answer is probably that this simply wasn't tested yet, so it can't be officially supported until it's tested. But as per the last comment, maybe I can fix that soonish.
does that sound right to you?
Yes! I missed that issue. Thank you ;)