Always rewrite shims, not just update meta-data. #893
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Always rewrite shims from scratch instead of doing meta-data comparison and updates, this means less state to maintain and less avenues where things can go wrong.
This also allows Homebrew to setup a
post_install
that triggersasdf reshim
.Details
So as I understand this, this checks if the meta-data inside a shim matches the expected version and plugin and rewrites the meta-data if it doesn't.
One of the issues is, that it doesn't check to see if the path to asdf has changed, this can happen when homebrew updates and asdf finds itself changed from
..../0.8.o/asdf
to..../0.8.1/asdf
But we never check the path, just the meta-data.
If a new version is released in Homebrew, the path above will be invalid.
I am open to adding a different command or an option like
--force
, but in general I think this is for the better unless I've missed a substantial reason for doing meta-data comparison instead of just rewriting the file each time.Performance is not it, as it is equally fast.
Edit: Might want to point out that this isn't 100% necessary if we want to skip
asdf
path being under a versioned namespace.We can always just resort to
exec /usr/local/opt/asdf/libexec/bin/asdf exec "iex" "$@"
but for some reason I think that having asdf namespaced under a version to be good hygiene, but it will require a reshim on asdf updates. This can be automated with post_install hook but needs changes from this PR.Related:
Homebrew/homebrew-core#73173
#891