-
Notifications
You must be signed in to change notification settings - Fork 669
Search for the data directory using argv[0] *and* os.Executable() #3621
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
base: master
Are you sure you want to change the base?
Conversation
IMPORTANT NOTE: I have not actually tested this via homebrew, so someone who uses it should test this 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the linter errors (no naked returns).
I think the Godoc comment should also be updated to explain the additional stat test.
I haven't tested the code with homebrew on Linux either, but it looks fine to me.
And I'm curious: isn't this working around a bug in the shim? Shouldn't the shim update arg[0]
before exec'ing the correct command?
e3a0b83
to
188d5f1
Compare
This is all a bit weird for sure, but it's not particularly unusual, e.g. login shells are run with that being said! this made me step back and reevaluate the approach, and I realized there's a conceptually cleaner way of handling this: just always look for the directory to check based on both |
Some version managers like aqua rely on shims in $PATH to run the proper application. This isn't particularly unusual, but it was broken by the changes in lima-vm#3566, because directory lookup ends up pointing to *the shim* rather than the underlying installation. The existing logic already has the concept of falling back to os.Executable if a path based on `argv[0]` can't be determined, so this issue can be solved by just always checking os.Executable *in addition* to `argv[0]`. Signed-off-by: re:fi.64 <[email protected]>
Some version managers like aqua rely on shims in $PATH to run the proper application. This isn't particularly unusual, but it was broken by the changes in #3566, because directory lookup ends up pointing to the shim rather than the underlying installation.
The existing logic already has the concept of falling back to os.Executable if a path based on
argv[0]
can't be determined, so this issue can be solved by just always checking os.Executable in addition toargv[0]
.