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

A spurious warning is issued when unstowing a package #65

Closed
ruifm opened this issue Aug 19, 2019 · 47 comments
Closed

A spurious warning is issued when unstowing a package #65

ruifm opened this issue Aug 19, 2019 · 47 comments
Labels
Milestone

Comments

@ruifm
Copy link

ruifm commented Aug 19, 2019

System Information

$ stow --version
stow (GNU Stow) version 2.3.1
$ perl -v
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-thread-multi
$ uname -a
Linux garry 5.2.9-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 16 11:29:43 UTC 2019 x86_64 GNU/Linux

Description

Since this change, everytime I unstow package foo it gives be this message:

$ stow -D --verbose=3 foo
stow dir is /home/user/dotfiles
stow dir path relative to target /home/user is dotfiles
cwd now /home/user
Planning unstow of package foo...
Unstowing from . (cwd=/home/user, stow dir=dotfiles)
Unstowing dotfiles/foo/.foorc
UNLINK: .foorc
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles
and path /home/user/.bar/somerandom_bar_related_dir at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
and path /home/user/.bar/somerandom_different_bar_related_dir at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
Planning unstow of package foo... done
cwd restored to /home/user/dotfiles
cwd now /home/user

I will isolate the warning to make it clearer:

$ stow -D foo
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles
and path /home/user/.bar/somerandom_bar_related_dir at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
and path /home/user/.bar/somerandom_different_bar_related_dir at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.

I understand this is supposedly added for some unit test edge case but with normal usage is indeed creating a minor annoyance.

@aspiers
Copy link
Owner

aspiers commented Aug 20, 2019

Yes, I am seeing this too. Obviously the logic I had in my head when I wrote that was wrong, so I'll have to revisit it.

@aspiers aspiers added the bug label Aug 20, 2019
@ArifRoktim
Copy link

Perhaps reverting the commit that causes this issue would be a good stopgap? Along with a bump in the minor/patch version.

@ruifm
Copy link
Author

ruifm commented Feb 18, 2020

@aspiers it's been some time. Will you revert said commit and backport it to the latest stable release?

@autoferrit
Copy link

I have the same issue as well. No matter what I try to stow I get the same error.

@bensleveritt
Copy link

I can avoid the error by removing the symlink I have in the target directory. Not sure if Stow is working now though as restowing didn't add the missing file...

@Starraider
Copy link

I have the same problem. Any news on this?

@ruifm ruifm changed the title A meaningless warning is issued when unstowing a package A spurious warning is issued when unstowing a package May 18, 2020
@otakutyrant
Copy link

I encountered the same bug when I try to unstowing a package:

BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /home/otakutyrant/.steam/steam.pid at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /home/otakutyrant/.steam/sdk32/steam at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.

But this bug disappeares after I downgraded stow to 2.2.2-5 in Arch Linux.

@n1ete
Copy link

n1ete commented Jun 5, 2020

confirmation about the same bug here on arch with stow 2.3.1

@autoferrit
Copy link

Downgrading worked for me too. For reference, this is how I did it.

sudo pacman -U https://archive.archlinux.org/packages/s/stow/stow-2.2.2-5-any.pkg.tar.xz

@doolio
Copy link

doolio commented Sep 6, 2020

Same bug here on Parabola (i686) with stow 2.3.1-3.0. I've not downgraded as others have suggested (I presume I'd have to use the archlinux32 archives?) as I'd prefer not to lose the --dotfiles option introduced in 2.3.0. Any other workaround until this can be fixed?

Thanks for your time and stow.

@bensleveritt
Copy link

@doolio I managed to get past it by removing the symlink, maybe try that?

@WIttyJudge
Copy link

WIttyJudge commented Sep 12, 2020

Same bug

stow -v -R -t ~ zsh
UNLINK: .zshrc
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /home/wittyjudge/.steam/sdk32/steam at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /home/wittyjudge/.steam/steam.pid at /usr/share/perl5/vendor_perl/Stow.pm line 966, <DATA> line 22.
LINK: .zshrc => dotfiles/zsh/.zshrc (reverts previous action)

@autoferrit
Copy link

Well, it's been a year since @aspiers mentioned he needed to look at it with really no communication since then, and no changes in 15 months. At this point, I am not sure if this is just abandoned or not. I am either just going to fork it to try and fix it (Perl, so probably not) or just find another solution to using stow.

@doolio
Copy link

doolio commented Sep 27, 2020

@bensleveritt thanks. I did see your workaround solution but am apprehensive of just removing the symlink as I don't believe you can simly restow in that case.

@autoferrit
Copy link

@doolio if you run unlink targetfile that was created when running stow, and then re-run the stow command, it will place it back again.

@aspiers
Copy link
Owner

aspiers commented Oct 25, 2020

@autoferrit commented on September 16, 2020 4:47 AM:

Well, it's been a year since @aspiers mentioned he needed to look at it with really no communication since then, and no changes in 15 months. At this point, I am not sure if this is just abandoned or not. I am either just going to fork it to try and fix it (Perl, so probably not) or just find another solution to using stow.

Stow is definitely not abandoned - I use it every day, and have every intention of ploughing through the backlog (including this issue which probably annoys me at least as much as everyone else!). If it's any comfort I feel terrible for taking this long so far, and given that my diary is unusually clear from Tuesday, I'm going to risk making a public promise that this will be addressed in a new release by the end of next Sunday - hopefully putting that commitment out there will help me finally stop other things getting in the way this time!

@ruifm
Copy link
Author

ruifm commented Oct 25, 2020

Thanks @aspiers good to see you back! I didn't plan on jumping the stow ship anytime soon even with this minor inconvenience (which is all it really is).

@doolio
Copy link

doolio commented Oct 25, 2020

Thank you Adam. I'm sure everyone understands that we all have busy schedules with so many things grappling for our attention and more importantly that Stow like so many other great pieces of free software is maintained by selfless volunteers such as yourself. Stow is one of those pieces of software that is indispensable to me so I personally appreciate all your efforts in maintaining it over the years.

@aspiers
Copy link
Owner

aspiers commented Oct 25, 2020

Thanks folks, your support means a lot :-)

@autoferrit
Copy link

@aspiers Yea I am glad it's not abandoned. But given I use stow regularly, it's a pretty annoying error since I can't seem to get rid of it, or hide it easily. And in all honesty, I am glad it is not abandoned and you still want to upkeep it! I think people just wanted to know you had planned on fixing it at some point. And that's good enough for me. I know maintaining OSS is a lot of work.
If I knew perl I would try to help, but I don't really have enough time to help. So I guess in that respect I shouldn't complain too much lol. Anyways, I'm stoked it's on your radar. stow really is to me, the best way to manage dotfiles.

@ArifRoktim
Copy link

ArifRoktim commented Oct 27, 2020 via email

@aspiers
Copy link
Owner

aspiers commented Nov 2, 2020

Quick update on this - I've spent most of today getting back into Stow maintenance mode, and I now fully understand this issue (briefly, it's caused by some code which automatically removes dangling symlinks owned by Stow) and I have a fix lined up, although I've taken the opportunity to clean up a bunch of other stuff along the way so it's taken a bit longer than expected. Unfortunately I've run out of time to make a release today (it's almost 2am here), and anyway there's another issue with the Docker images which needs to be addressed before I can make a release, but I'm going to continue with this in the morning. Sorry I didn't quite live up to my foolish promise to cut a new release today, but short of a catastrophe I should have one out this week for sure. I'm hoping it will address some of the other most annoying issues too, but we'll see.

@aspiers
Copy link
Owner

aspiers commented Nov 11, 2020

Well folks, not one but two unforeseen circumstances resulted in one of the most unpleasant and distracting weeks I've had in a long while, but everything is resolved now so I'm back to work on Stow.

I'll explain where I am with this particular issue. When unstowing a package, cleanup_invalid_links() is invoked to remove any invalid links owned by Stow. It has been invoking link_owned_by_package() to check whether each existing link is owned by Stow. This in turn calls find_stowed_path() which since 40a0807 was not allowing for the possibility that it could be passed a symlink not owned by Stow with an absolute target. When I introduced 40a0807 this possibility had not occurred to me, which is why we are seeing this erroneous (and benign) warning.

I could just remove the warning but it's not a full fix as it re-raises the question of whether Stow should support symlinks with absolute paths as described in issue #3 (with a proposed solution in PR #68) - which is one of the issues I was hoping to tackle in this current batch of work.

So I'm inclined to spend a little longer getting my head around #3 before deciding the best approach to this. Having said that, in the unlikely case that this warning is causing you serious issues and you need it urgently removed, then please let me know and maybe I can do a quick release just to address that.

@ashok-arora
Copy link

I am still facing the issue, is there anything I can do in the meantime as a workaround?

@aspiers
Copy link
Owner

aspiers commented Dec 9, 2020

You can either ignore the warning (it's harmless) or comment out the two lines of code in Stow.pm which generate it.

@nullman
Copy link

nullman commented Jan 11, 2021

I just started using stow, replacing some custom code that did the same thing, but not as well. I'm using it to link my git dot-file repos (one public and one private) to my home dir. I'm also getting this issue with any existing links that stow does not control. I'll just live with it until a fix shows up in Manjaro.

For any that just want the output to disappear, you can do something like this:

stow OPTIONS 2>&1 | grep -v "BUG in find_stowed_path"

Just note that it redirects all errors to stdout so it might affect other behavior if run inside of a script.

@ysl2
Copy link

ysl2 commented Jan 29, 2021

Stow is a nice dotfiles manager, I'm looking forward the problem will be solved :-)

@aspiers aspiers pinned this issue Feb 19, 2021
ktsuda added a commit to ktsuda/dotfiles that referenced this issue Feb 15, 2022
This suppresses the warning message that is caused by the known bug of
stow command.  See aspiers/stow#65.
Toalaah added a commit to Toalaah/ansible that referenced this issue Apr 19, 2022
The bug is known + harmless. Easier to just ignore it for now as the
message trips up the execution of the playbook w/ a non-0 exit code.

For reference, see: aspiers/stow#65
roosta added a commit to roosta/etc that referenced this issue May 27, 2022
@tebuevd
Copy link

tebuevd commented Aug 28, 2022

any update?

@nimser
Copy link

nimser commented Oct 11, 2022

For me it shows the errors but also doesn't actually restows. Is this due to this issue ?

@doolio
Copy link

doolio commented Oct 11, 2022

This bug should have no affect on restowing. At least it doesn't for me. Running the same version as OP.

@RaphGL
Copy link

RaphGL commented Feb 9, 2023

Hey, I appreciate the project and have been using it for years now.
I read this thread and apparently the issue is still yet to be fixed.

Imo this should be considered a feature breaking bug, as without the ability to handle absolute paths the program will simply error out and refuse to do anything. You cannot adopt, override nor remove symlinks with absolute paths as it thinks of those paths as "not owned".

There was a pull request fixing this issue (#68 ) but it has not yet been merged.

@huwqchn
Copy link

huwqchn commented Feb 16, 2023

Any updates

@aspiers
Copy link
Owner

aspiers commented Feb 17, 2023

Please see #33 (comment)

I am (painfully) aware of these outstanding issues :-(

@RaphGL
Copy link

RaphGL commented Feb 17, 2023

Please see #33 (comment)

I am (painfully) aware of these outstanding issues :-(

Oh I see. Yeah, I can see how that would be stressful. A lot of people depend on or have used your project for managing linux/unix dotfiles and sadly with open source finding people that care enough to help maintaining the project is a challenge.

Probably this being a perl project also has made finding people willing to work on it harder. Please consider asking for help on linux and programming related subs on reddit. Or alternatively consider a rewrite in python or go or another language with a sizable and passionate following that would be more likely to participate as the project is just a little over 2000 lines and this could easily be rebuilt by just a couple developer in a month or less (even though this is risky and might incur having some bugs so probably a last resort).

Either way, please don't feel too pressured by us, stow works and have worked really well for most use cases for the past years, the bugs are minor annoyances but that can for the most part be worked around with small commands and scripts. Take your time :)

@aspiers
Copy link
Owner

aspiers commented Feb 17, 2023

Yes it is a real problem these days that it's written in Perl. I think a Python rewrite would be fantastic and I have considered that before as I have a lot of experience in Python. The way to do it would be to figure out how to run the Perl test suite on the Python implementation, get that to 100% pass rate, then rewrite the test suite in Python (or maybe parallelise the two to some degree).

That said, it shouldn't be particularly hard for any Python dev to look at the Stow code and understand most of what's going on straight away. The main challenge is not getting hung up by all the "weird" syntax like @_, $_[0] etc. but that can be learned very quickly.

@dabrahams
Copy link

As a workaround I'm using a little wrapper around stow; HTH someone:

#!/usr/bin/env bash -e -o pipefail

# Forward arguments to GNU stow and strip any spurious warning
# (https://github.com/aspiers/stow/issues/65)
stow "$@" \
  2> >(grep -v 'BUG in find_stowed_path? Absolute/relative mismatch' 1>&2)

@aspiers
Copy link
Owner

aspiers commented Mar 18, 2023

Nice. You can also just comment out the line in Stow.pm which causes that.

@dabrahams
Copy link

Yes, but I don't want to maintain a fork :-)

phantomwhale added a commit to phantomwhale/dotfiles that referenced this issue Mar 23, 2023
Suppresses the harmless warning lines coming out of stow

Ref: aspiers/stow#65 (comment)
justinnhli added a commit to justinnhli/dotfiles that referenced this issue Apr 29, 2023
danemacmillan added a commit to danemacmillan/dotfiles that referenced this issue May 9, 2023
This output redirection was suggested by a comment in aspiers/stow#65.
@simonm
Copy link

simonm commented Sep 25, 2023

As a workaround I'm using a little wrapper around stow; HTH someone:

#!/usr/bin/env bash -e -o pipefail

# Forward arguments to GNU stow and strip any spurious warning
# (https://github.com/aspiers/stow/issues/65)
stow "$@" \
  2> >(grep -v 'BUG in find_stowed_path? Absolute/relative mismatch' 1>&2)

Small addition... To make sure this works, you need:
1 - Ensure this script is first in your $PATH
2 - Edit the script to explicitly call /usr/bin/stow

[..snip..]
/usr/bin/stow "$@" \
   2> >(grep -v 'BUG in find_stowed_path? Absolute/relative mismatch' 1>&2)

@Bryan2333
Copy link

Bryan2333 commented Dec 1, 2023

Here is the fish shell wrapper function for stow based on @dabrahams

function stow
    bash -c "stow $argv 2> >(grep -v 'BUG in find_stowed_path? Absolute/relative mismatch' 1>&2)"
end

You can put the content to the ~/.config/fish/functions/stow.fish

@fabinhorsff
Copy link

Hello! Just to register that this error is still present in Feb-2024.

I get the following trying to unstow.

BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /Users/user/Dropbox/org/roam/contatos.org at /usr/local/Cellar/stow/2.3.1//Library/Perl/5.30/Stow.pm line 966, <DATA> line 22.
BUG in find_stowed_path? Absolute/relative mismatch between Stow dir dotfiles and path /Users/user/Library/Application Support/Google/DriveFS/100920322747728924973/my-drive at /usr/local/Cellar/stow/2.3.1//Library/Perl/5.30/Stow.pm line 966, <DATA> line 22.

IT seems to want to take over Google Drive Backup and Sync's symlinks... Weird.

I hope all is well, and I really (REALLY) hope this project is maintained. I just found out about it and I am having a blast configuring with it!

Thanks!

@RaphGL
Copy link

RaphGL commented Feb 21, 2024

@fabinhorsff there hasn't been any new releases since 2019 and no new commits on the master branch since 2021, I think it's fair to say that this bug is here to stay for quite a while

@braindotai
Copy link

aaah man

@aspiers
Copy link
Owner

aspiers commented Apr 4, 2024

For now, please see the interim update and apology here: #70 (comment)

TL;DR: this bug is fixed in the dev branch, and I will do my utmost to cut a release this weekend.

Proper communications to follow this weekend.

@aspiers aspiers closed this as completed in 8436768 Apr 6, 2024
askoufis added a commit to askoufis/dotfiles that referenced this issue Apr 8, 2024
- The issue was fixed in v2.4.0 of GNU stow
- aspiers/stow#65
@aspiers aspiers unpinned this issue Apr 10, 2024
jpasquier added a commit to jpasquier/stoww that referenced this issue Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests