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

fix(fish): use builtin realpath over system one #1637

Merged
merged 1 commit into from
Sep 12, 2023

Conversation

MageJohn
Copy link
Contributor

Summary

Fixes the issue raised in a PR comment here: #1583 (comment)

Fish treats their realpath builtin as a fallback in case a system version doesn't exist. Not all versions of realpath support the --no-symlinks flag, which asdf.fish uses. This PR ensures that the builtin version of realpath is always used.

Other Information

Just as a note for posterity, the --no-symlinks flag for the builtin realpath was added in fish 3.2.0, released in March 1, 2021. 2 years old is good, but some slower Linux distros may lack support. If that proves to be a problem, then perhaps a different solution can be found. I think long term though the builtin will offer the best support across different systems.

@MageJohn MageJohn requested a review from a team as a code owner September 11, 2023 16:58
@cr0t
Copy link

cr0t commented Sep 11, 2023

These changes also resolve the issue on macOS because system realpath doesn't support the given options.

I just updated to the latest asdf version 0.13.0 and started to get this error at the beginning of my sessions:

realpath: illegal option -- -
usage: realpath [-q] [path ...]
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
> ~

@MageJohn's patch fixes the problem.

Copy link
Contributor

@jthegedus jthegedus left a comment

Choose a reason for hiding this comment

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

Great contribution, thanks!

@jthegedus jthegedus merged commit 5ac3032 into asdf-vm:master Sep 12, 2023
7 checks passed
@jthegedus
Copy link
Contributor

You can use this change by pulling the latest code with asdf update --head

@sample-usr
Copy link

Any idea when will this be released? asdf update --head doesn't work if installed via brew.

@kblcuk
Copy link

kblcuk commented Sep 13, 2023

@rebebop at least according to github releases, 0.13.1 was release 4 minutes ago, so give it some time :)
https://github.com/asdf-vm/asdf/releases/tag/v0.13.1

@cr0t
Copy link

cr0t commented Sep 13, 2023

@rebebop if you're rushing, you can edit the asdf.fish file manually, it's here: /usr/local/opt/asdf/libexec/asdf.fish (at least on my machine).

Just add builtin on the 2nd line to get this:

if test -z $ASDF_DIR
    set ASDF_DIR (builtin realpath --no-symlinks (dirname (status filename)))
end
# ...

@sample-usr
Copy link

@rebebop at least according to github releases, 0.13.1 was release 4 minutes ago, so give it some time :) v0.13.1 (release)

@kblcuk All good :), when I posted, which was an hour ago, it was obviously not released so was only wondering.
@cr0t Thanks for the snippet

@MageJohn MageJohn deleted the fish-builtin-realpath branch September 13, 2023 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants