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

fisher update not install plugin but remove fish_plugins file #790

Open
taikulawo opened this issue Jun 2, 2024 · 32 comments
Open

fisher update not install plugin but remove fish_plugins file #790

taikulawo opened this issue Jun 2, 2024 · 32 comments
Labels
bug Something isn't working

Comments

@taikulawo
Copy link

I sync fish config across machine by git.
But on another machine I run fisher update, fisher just delete fish_plugins
image

@jorgebucaran
Copy link
Owner

Hmm, I really can't help without more info. Maybe share your entire configuration and sync strategy, maybe in a Docker image or a repository.

@taikulawo
Copy link
Author

extract to fish/ then run fisher update
fish.tar.gz

@jorgebucaran
Copy link
Owner

Could you share the contents here instead?

@taikulawo
Copy link
Author

sure. fish_plugins file

jorgebucaran/fisher
patrickf1/fzf.fish

and install fisher

@jorgebucaran
Copy link
Owner

Is that what's in your gzipped tar file? What I need is your complete configuration and sync setup. Without it, reproducing your state won't be possible anytime soon.

@taikulawo
Copy link
Author

https://github.com/taikulawo/home I clone (means sync)it on my homedir

@jorgebucaran
Copy link
Owner

The only file I'd put in my dot files would be fish_plugins, similar to how you wouldn't sync node_modules.

@taikulawo
Copy link
Author

I dont understand, I'm wrong?

@jorgebucaran
Copy link
Owner

I saw you're committing all Fish files in your repo, including plugins likely installed with Fisher. In that case, what would be the purpose of fish_plugins? This file serves as a manifest of your plugins and should be enough for syncing across different machines. You'd simply use fisher install to install the plugins instead of relying on git.

@taikulawo
Copy link
Author

taikulawo commented Jun 2, 2024

Does fisher install not extra argument can install all plugin in manifest?

$ fisher install
fisher: Not enough arguments for command: "install"

sometime my network is offline, so I need to sync plugin file at first. but why fisher delete fish_plugins when I run fisher update?

@jorgebucaran
Copy link
Owner

Thanks for the clarification. You're right, it's fisher update (not install), as indicated in the docs. 👍

@jorgebucaran
Copy link
Owner

Yes, Fisher will delete fish_plugins, but only if it's empty. For example, if you remove all plugins from fish_plugins and then run fisher update, Fisher will uninstall all plugins and subsequently delete the file.

else
set --erase _fisher_plugins
command rm -f $fish_plugins
end

@taikulawo
Copy link
Author

but my file_plugins is not empty

@jorgebucaran
Copy link
Owner

My approach to test this:

  • Set up two machines, A and B.
  • On machine A, install Fisher and other necessary plugins.
  • Save or sync the fish_plugins file to machine B.
  • On machine B, run fisher update.

This process should make sure that B is updated to match A, which is how Fisher is supposed to work.

@taikulawo
Copy link
Author

oh, I found reason
when I init fisher, fisher add following variables to fish_variables file. But my sync don't include it. On another manchine which don't have this variable, fisher will remove fish_plugins file

SETUVAR __fish_initialized:3400
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher

@taikulawo
Copy link
Author

Is those variable necessary? I think fish_plugins is enough

@jorgebucaran
Copy link
Owner

The approach I outlined above should do for a basic setup. For example, if you uninstall all your plugins, start from scratch, create a fish_plugins file, add several plugins to it, and then run fisher update, Fisher should install those plugins. But if this isn't enough for you, how about committing your fish_variables in addition to your fish_plugins.

@taikulawo
Copy link
Author

taikulawo commented Jun 2, 2024

fish_variables is platform special. I sync all my conf across different platform, linux/mac, so fish_variables isn't suitable for my case if I sync it, which make linux variable sync to windows, broken

@taikulawo
Copy link
Author

from my test, If target machine don't have fisher special variable in fish_variables, fisher update will broken, delete fish_plugin file

@jorgebucaran
Copy link
Owner

Fisher cleans and variables before saving or reading from fish_variables to prevent some basic issues, e.g.:

command rm -rf (string replace -- \~ ~ $$plugin_files_var)

...but I don't know about Windows.

@jorgebucaran
Copy link
Owner

What I did: I made sure there were no Fisher variables in fish_variables, uninstalled everything Fisher-related, created an empty fish_plugins file, added some plugins, thus replicating a machine without Fisher but with my fish_plugins file. Then, fisher update, and it behaved as expected; the plugins were installed.

@taikulawo
Copy link
Author

you should exit fish, and reopen a new fresh fish instance, make sure there not fisher variable. then fisher update

@jorgebucaran
Copy link
Owner

I did that and succeeded. Did that not work for you?

@taikulawo
Copy link
Author

rm -rf ~/.config/fish
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
rm ~/.config/fish/fish_variables
# let fish exit now

# open a new fish shell
# make sure no value output
echo $_fisher_plugins
# run fisher update, fish_plugins file should be deleted
fisher update

@jorgebucaran
Copy link
Owner

To clarify, did this work out for you?

@taikulawo
Copy link
Author

rm -rf ~/.config/fish
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
rm ~/.config/fish/fish_variables
# let fish exit now

# open a new fish shell
# make sure no value output
echo $_fisher_plugins
# run fisher update, fish_plugins file should be deleted
fisher update

no, it's bug reproduce step.

@jorgebucaran
Copy link
Owner

Sorry for the long silence and thanks for the script. I haven't been able to repro the issue yet, but I'll try to dig into it again soon. 👍

@jorgebucaran jorgebucaran added the bug Something isn't working label Sep 10, 2024
@00sapo
Copy link

00sapo commented Oct 18, 2024

I'm also experiencing the same issue.
Having deleted fish_variables makes $_fisher_plugins empty. When doing fisher update, it tries to update the plugins from $_fisher_plugins, but errors saying that files are present. I guess it doesn't expect them because it's checking $_fisher_plugins instead of fish_plugins. It ends with "syncing" fish_plugins with $_fish_plugins, and thus deleting it.

Is those variable necessary? I think fish_plugins is enough

I agree, it doesn't look really useful, since it's just an exact copy of fish_plugins

@jorgebucaran
Copy link
Owner

Do you sync your Fish config across different machines using Git? I know some people use Fisher for that, and Fisher makes it easy, but I still don't understand how you ran into this issue.

@mercxry
Copy link

mercxry commented Oct 22, 2024

I ran into the same issue! My dotfiles include the completions, functions, and conf.d folders, which contain plugin files, but I don’t include the fish_variables file because it can have sensitive data and isn't always compatible across environments.

To reproduce you can try removing all the fisher variables from the fish_variables file and run either fisher install or fisher update and you should get something like this (you might want to backup your fish_plugins and fish_variables files first):

CleanShot 2024-10-22 at 20 59 03@2x


I expected fisher install or fisher update to create any missing files and update things like fish_variables, but instead, I get an error saying the plugin files already exists, and it removes the fish_plugins file.

It would be awesome if there were a way to force an install/update, like fisher install --force. Another idea could be to remove the dependency on fish_variables entirely or treat it as a cache rather than the source of truth, but in any case I don't think the fish_plugins file should be deleted. What do you think?

@JoshuaToenyes
Copy link

I'll echo @mercxry. I'm currently working through the same issues described above. I'm new to Fisher, but I expected a fisher install or fisher update to recognize that the completions, functions, and configuration files were already present... but instead it complains about conflicting files.

fisher: Cannot install "jorgebucaran/fisher": please remove or move conflicting files first:
        /home/josh/.config/fish/completions/fisher.fish

I would also like to avoid keeping fish_variables in git to avoid accidentally leaking secrets...

I was able to bootstrap the new system by removing the conflicting files, running fish update, and now all seems fine... but I'm sure I'll run into problems if I store files managed by fisher in version control.

I suppose another approach would be to allow fisher to manage all content in completions, conf.d, functions, etc., but that seems less than ideal to me.

@00sapo
Copy link

00sapo commented Nov 20, 2024

Do you sync your Fish config across different machines using Git? I know some people use Fisher for that, and Fisher makes it easy, but I still don't understand how you ran into this issue.

Yes, all the config directory is under git for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants