jorgebucaran / fisher

A plugin manager for Fish
https://git.io/fisher
MIT License
7.53k stars 257 forks source link

Failed update leads to disappeared fisher #752

Closed nc7s closed 5 months ago

nc7s commented 1 year ago

Sometimes with bad network, fisher update fails, and that leads to disappeared fisher and other installed plugins.

When the update fails, fisher complains like this (you can see the prompt changed from tide to fish default because tide was gone):

❯ fisher update
fisher update version 4.4.3
Fetching https://api.github.com/repos/jorgebucaran/fisher/tarball/HEAD
Fetching https://api.github.com/repos/edc/bass/tarball/HEAD
Fetching https://api.github.com/repos/jorgebucaran/nvm.fish/tarball/HEAD
Fetching https://api.github.com/repos/jethrokuan/z/tarball/HEAD
Fetching https://api.github.com/repos/ilancosman/tide/tarball/v5
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/kh/xxqhxpvx5_x1j7hp2hdtdrmh0000gn/T/tmp.IrvzNd5Z
                                           ^
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/kh/xxqhxpvx5_x1j7hp2hdtdrmh0000gn/T/tmp.YzuCjcCq
                                           ^
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/kh/xxqhxpvx5_x1j7hp2hdtdrmh0000gn/T/tmp.Z50iNsuf
                                           ^
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/kh/xxqhxpvx5_x1j7hp2hdtdrmh0000gn/T/tmp.ynIV0T3f
                                           ^
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/kh/xxqhxpvx5_x1j7hp2hdtdrmh0000gn/T/tmp.8oRypeYE
                                           ^
Installing jorgebucaran/fisher
Installing edc/bass
Installing jorgebucaran/nvm.fish
Installing jethrokuan/z
Installing ilancosman/tide@v5
Updated 5 plugin/s
i@madagascar /Users/i > fisher
fish: Unknown command: fisher
i@madagascar /Users/i > 

My guess is that "old" copies were deleted regardless of the download, but haven't digged into that chunk of "eval" code to confirm it.

Using fisher 4.4.3 with kitty 0.26.5 on macOS 13.1.

jorgebucaran commented 1 year ago

Do you know how I could go about reproducing this behavior?

nc7s commented 1 year ago

Oh sorry, forgot to include reproducing steps. Just disconnect your computer's network to make the download fail.

cupcakearmy commented 1 year ago

Same here

jorgebucaran commented 1 year ago

How often does this actually happen? Like, why are we using Fisher with a bad network to begin with?

nc7s commented 1 year ago

Because we have no control over network conditions? Carrier QoS, network congestion, etc. That's why retries are a standard in many network facing applications.

cupcakearmy commented 1 year ago

For me it has nothing to do with network. I was setting up fisher with my dotfiles and it was failing if files of the plugins already existed

jorgebucaran commented 1 year ago

@cupcakearmy ...it was failing if files of the plugins already existed

See https://github.com/jorgebucaran/fisher/issues/624 for background. A --force flag has been proposed, but no one is currently working on it. Would that flag help in your case?

jorgebucaran commented 1 year ago

This doesn't appear to be a simple adjustment, but ideally, we would want to revert if the network goes down. If anyone has an elegant, streamlined solution, I'm all ears! Otherwise, we can address this in Fisher 5. Maintaining Fisher as small, concise, and simple is a core objective of the project, so there's no guarantee that I'll work on this, but I will certainly look into it. 🙌

nc7s commented 1 year ago

With the existing files scenario this looks like a failure recovery in general, i.e. update/download to a temp dir and replace the old only when the new is verified to be usable. Still the verification needs a good concept and implementation.

igalic commented 1 year ago

if git is available on the system, we could git clone the repository into $XDG_STATE_HOME/fisher and go from there

ProgrammAbel commented 10 months ago

Is there any sort of temporary fix for this? I can work with a broken prompt but I really need nvm.fish for work. How would I go about uninstalling and reinstalling fisher along with all plugins?

jorgebucaran commented 10 months ago

A possible temporary solution is to minimize the use of Fisher when you're on an unreliable network. 😉

And you can probably fix all the issues by reinstalling:

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
ProgrammAbel commented 10 months ago

I'm on a stable network now (I think before I was on train WiFi that wasn't very reliable), however when trying to reinstall using the command, it comes up with a similar error:

binoop@abels-air.lan /Users/binoop > curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
fisher install version 4.4.3
Fetching https://api.github.com/repos/jorgebucaran/fisher/tarball/HEAD
fish: No matches for wildcard '$temp/*/*'. See `help wildcards-globbing`.
                            command cp -Rf $temp/*/* /var/folders/73/hmmpx_4501b3_ty6sr7vkhm80000gn/T/tmp.5RFUOPp8
                                           ^~~~~~~~^
Installing jorgebucaran/fisher
Updated 1 plugin/s

And it doesn't do anything :/

jorgebucaran commented 10 months ago

Could you provide more details about your environment?

ProgrammAbel commented 10 months ago

I'm running fisher 4.4.3 with fish 3.6.0 and iTerm2 3.4.20 on macOS Ventura 13.5. All running on M1 MacBook Air.

jorgebucaran commented 10 months ago

I'm not sure what the issue is. If Fisher is already installed, try removing everything first:

fisher ls | fisher remove
ProgrammAbel commented 10 months ago

Well, fisher does let me remove everything, but the same error occurs when attempting to install fisher again. Is there any way to manually get rid of the command with all it's files altogether?

jorgebucaran commented 10 months ago

All plugins should be gone. Open a new terminal to check if fisher is still there.

If the issue persists, cd into ~/.config/fish/functions and delete the fisher.fish file for good.

ProgrammAbel commented 10 months ago

Hmm. I removed fisher with fisher remove and opened a new terminal, but was still able to invoke the fisher command. I went into ~/.config/fish/functions and fisher.fish isn't there, despite the fact that I'm still able to invoke it...

nc7s commented 10 months ago

Maybe try type fisher to see where it really comes from.

ProgrammAbel commented 10 months ago

Okay, so for some reason I had installed fisher using homebrew? Uninstalled that but now the normal way to install isn't working:

binoop@abels-air ~> curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
fish: Unknown command: fisher
fish:
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
                                                                                                      ^~~~~^
jorgebucaran commented 10 months ago

I don't recommend installing Fisher using brew, but that's a different topic. Do you happen to have a .curlrc file? That could be the problem.

ProgrammAbel commented 10 months ago

Honestly I don't even remember installing it via Homebrew at all, but oh well 🤷

I don't have a .curlrc file.

jorgebucaran commented 10 months ago

Does this print anything to your console?

curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish
ProgrammAbel commented 10 months ago

No, it gives a return code of 35. And yeah looking at the code for fisher.fish I am beginning to see the issue now. I guess that's the problem then, I have been facing difficulty with curl recently, but not exactly sure how to fix it.

jorgebucaran commented 10 months ago

Well, curl is required for using Fisher, so you'll need to sort that out.

See here: https://curl.se/download.html#MacOSX

And while you're at it, double-check to make sure you don't have a .curlrc file lurking in your home directory. Some people have good reasons for having one, but it doesn't look like that's the case for you.

nc7s commented 10 months ago

curl code 35 is SSL/TLS error. You may want to add -vvv after curl to see what's going on (or not, if it already gave a clear explanation).

Anyway, this looks like another "bad network" scenario. Details of curl error is irrelevant for this issue.

ProgrammAbel commented 10 months ago

Completely my bad, I hadn't realised a firewall program of mine was blocking curl 🤦 Sorry for wasting your time, it's working perfectly now, thank you!

nc7s commented 10 months ago

if git is available on the system, we could git clone the repository into $XDG_STATE_HOME/fisher and go from there

This is actually a pretty viable solution I somehow overlooked.

Quite a few things just git clone to install and git pull to update: (n)vim plugin managers to name an example.

At least git handles failure recovery; a naive download & overwrite approach, hardly so.

jorgebucaran commented 7 months ago

This is a rare occurrence. Fisher generally performs well for most users, and direct downloads tend to be faster. Previously, we used git for handling downloads but switched to our current, more straightforward and minimal approach for its simplicity. It was a trade-off we decided to make.

nc7s commented 5 months ago

Simplicity is great, I love it too, but the real world is unfortunately unreliable, sometimes ugly. To make things work reliably, often requires solutions not so "straightforward" or "minimal". You are lucky to have never encountered bad network conditions, I hope it keeps that way.

Closing since it's no more concern for me. Still, thanks for the fish.

jorgebucaran commented 5 months ago

I got your point. This is a trade-off. Look, if we can manage this more efficiently without adding significant complexity, then it's worth considering. PR welcome!