Repository navigation
fix(install): keep incomplete-install markers out of the cache #14051
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
Merged
+414
−80
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
968edf2
fix(install): keep incomplete-install markers out of the cache
jdx e1fecc1
Merge origin/main; migrate legacy incomplete markers
jdx 8e118c7
fix(install): recheck a legacy marker after taking its lock
jdx 4cbab78
test(install): plant incomplete markers in the state dir
jdx 5b0d034
fix(install): keep migrating past an unreadable cache entry
jdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # A version whose install never finished stays incomplete after the cache is | ||
| # cleared, so it is neither listed nor selected over the complete one. | ||
| plugin="$MISE_DATA_DIR/plugins/halfdone" | ||
| mkdir -p "$plugin/bin" | ||
| cat >"$plugin/bin/list-all" <<'SH' | ||
| #!/usr/bin/env bash | ||
| echo 1.0.0 1.1.0 | ||
| SH | ||
| # 1.1.0 writes a working binary, then fails: an install that died partway. | ||
| cat >"$plugin/bin/install" <<'SH' | ||
| #!/usr/bin/env bash | ||
| mkdir -p "$ASDF_INSTALL_PATH/bin" | ||
| printf '#!/usr/bin/env bash\necho "halfdone %s"\n' "$ASDF_INSTALL_VERSION" >"$ASDF_INSTALL_PATH/bin/halfdone" | ||
| chmod +x "$ASDF_INSTALL_PATH/bin/halfdone" | ||
| [ "$ASDF_INSTALL_VERSION" != "1.1.0" ] | ||
| SH | ||
| chmod +x "$plugin/bin/list-all" "$plugin/bin/install" | ||
|
|
||
| cat >mise.toml <<'TOML' | ||
| [tools] | ||
| halfdone = "1" | ||
| TOML | ||
|
|
||
| mise install halfdone@1.0.0 | ||
| assert "mise x -- halfdone" "halfdone 1.0.0" | ||
|
|
||
| # Keep the half-done install directory, as `always_keep_install` does. | ||
| assert_fail "MISE_ALWAYS_KEEP_INSTALL=1 mise install halfdone@1.1.0" | ||
| assert_directory_exists "$MISE_DATA_DIR/installs/halfdone/1.1.0" | ||
| assert_not_contains "mise ls --installed halfdone" "1.1.0" | ||
| assert "mise x -- halfdone" "halfdone 1.0.0" | ||
|
|
||
| mise cache clear | ||
| assert_directory_exists "$MISE_STATE_DIR/incomplete-installs/halfdone/1.1.0" | ||
| assert_not_contains "mise ls --installed halfdone" "1.1.0" | ||
| assert "mise x -- halfdone" "halfdone 1.0.0" | ||
|
|
||
| # Uninstalling the half-done version clears its marker with it. | ||
| mise uninstall halfdone@1.1.0 | ||
| assert_directory_not_exists "$MISE_DATA_DIR/installs/halfdone/1.1.0" | ||
| assert_directory_not_exists "$MISE_STATE_DIR/incomplete-installs/halfdone/1.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.