Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stow a absolute symlink #76

Closed
Kamilcuk opened this issue Jan 28, 2021 · 3 comments
Closed

Stow a absolute symlink #76

Kamilcuk opened this issue Jan 28, 2021 · 3 comments

Comments

@Kamilcuk
Copy link

Kamilcuk commented Jan 28, 2021

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.

@aspiers
Copy link
Owner

aspiers commented Apr 8, 2021

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).

@aspiers
Copy link
Owner

aspiers commented Apr 8, 2021

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.

@Kamilcuk
Copy link
Author

Kamilcuk commented Apr 8, 2021

does that sound right to you?

Yes! I missed that issue. Thank you ;)

@aspiers aspiers closed this as completed Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants