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

Detect when $fisher_path = $fisher_config and exit with error message #537

Closed
wants to merge 1 commit into from

Conversation

9999years
Copy link

The fishfile is stored at $fisher_path/fishfile, and _fisher_commit executes rm -rf $fisher_config, so if $fisher_path = $fish_config, running fisher will delete the fishfile before looking for packages, leading to confusing errors.

Adds a check to fisher, exiting with a message like

$fisher_path (/home/arvensis/.config/fisher) cannot be /home/arvensis/.config/fisher
Consider instead:
    set -g fisher_path "$HOME/.config/fisher_local"

To prevent user confusion in the future.

The fishfile is stored at $fisher_path/fishfile, and _fisher_commit
executes `rm -rf $fisher_config`, so if $fisher_path = $fish_config,
running `fisher` will delete the fishfile before looking for packages,
leading to confusing errors.

Adds a check to `fisher`, exiting with a message like

    $fisher_path (/home/arvensis/.config/fisher) cannot be /home/arvensis/.config/fisher
    Consider instead:
        set -g fisher_path "$HOME/.config/fisher_local"

To prevent user confusion in the future.
# executes `rm -rf $fisher_config`, so if $fisher_path = $fish_config,
# running `fisher` will delete the fishfile before looking for packages,
# leading to confusing errors.
if test (readlink "$fisher_path") = (readlink "$fisher_config")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@9999years I don't believe using readlink is cross-Unix compatible?

@jorgebucaran
Copy link
Owner

@9999years I see what's going on here. I suppose you run into this, hence the desire to add a check, but I suspect $fisher_path being equal to $fish_config is an oddity. Can't back up my claim, though, so who knows?

For starters, we 'd need to switch from readlink to something compatible across Unices. The realpath builtin is the easy way out, but that means dropping support for a bunch of older fish.

On the other hand, a comment in the docs might be the next best thing to do here. Thoughts?

@reitzig
Copy link

reitzig commented May 4, 2020

I suspect $fisher_path being equal to $fish_config is an oddity. Can't back up my claim, though, so who knows?

Don't you always set it, though?

set -q fisher_path; or set -g fisher_path $fish_config

Not sure how $fisher_path could have been set already at that point. But then, I also don't understand why that line makes sense, so maybe I'm missing something fundamental here.

@jorgebucaran
Copy link
Owner

Hi @9999years, sorry for the late reply. Would you mind checking if this is still issue in fisher@3.2.12?

@jorgebucaran
Copy link
Owner

Not going to merge here, but I'll revisit this issue when I start working on #582.

Repository owner locked and limited conversation to collaborators Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants