fix(installer): normalize current version before comparison#8649
fix(installer): normalize current version before comparison#8649
Conversation
Signed-off-by: tak848 <pairs_char0j@icloud.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in the standalone installer where version comparisons were consistently failing due to a mismatch in how version strings were formatted. By normalizing the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Greptile SummaryThis PR fixes a long-standing bug in the standalone installer where the current-version fast-path (embedded checksums and CDN tarball URL) was never reached because Key changes:
The fix is minimal, correct, and well-scoped — the Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["install_mise() called"] --> B["version = MISE_VERSION or MISE_CURRENT_VERSION\nstrip leading v"]
A --> C["current_version = MISE_CURRENT_VERSION\nstrip leading v ← NEW"]
B --> D{"version == current_version\n(both v-stripped)?"}
C --> D
D -- "No (different version) OR\nMISE_INSTALL_FROM_GITHUB=1" --> E["tarball_url = GitHub releases URL\nhttps://github.com/.../mise-v{version}-..."]
D -- "Yes (current version) AND\nMISE_TARBALL_URL set" --> F["tarball_url = MISE_TARBALL_URL"]
D -- "Yes (current version) AND\nno override" --> G["tarball_url = CDN URL\nhttps://mise.jdx.dev/v{version}/..."]
E --> H["download_file(tarball_url)"]
F --> H
G --> H
H --> I["get_checksum(version, os, arch, ext)"]
I --> J["current_version = MISE_CURRENT_VERSION\nstrip leading v ← NEW"]
J --> K{"version == current_version?"}
K -- "Yes" --> L["Use embedded static checksums\n(MISE_CHECKSUM_* vars)"]
K -- "No" --> M["Fetch SHASUMS256.txt from GitHub releases"]
L --> N["Validate checksum → extract tarball"]
M --> N
Last reviewed commit: "fix(installer): norm..." |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a bug in the standalone installer script where version comparisons would fail due to inconsistent 'v' prefixes. The fix involves normalizing the MISE_CURRENT_VERSION variable before it's used in comparisons within the get_checksum and install_mise functions. My review includes suggestions to make the new code slightly more concise while maintaining correctness.
| current_version="$MISE_CURRENT_VERSION" | ||
| current_version="${current_version#v}" |
There was a problem hiding this comment.
This file is an envsubst template. $MISE_CURRENT_VERSION is substituted literally before the shell runs, so writing ${MISE_CURRENT_VERSION#v} would be expanded into ${v2026.3.9#v}, which breaks. The two-line form captures the substituted value into a local variable first, then strips the prefix.
| current_version="$MISE_CURRENT_VERSION" | ||
| current_version="${current_version#v}" |
There was a problem hiding this comment.
Same as above — envsubst constraint requires the two-line form.
|
coverage-7 failure is unrelated to this PR — caused by Java EA version bump (26 → 27). Fix is tracked in #8634 |
Summary
install.shformat unchangedProblem
The standalone installer strips the leading
vfrom the selected version before using it:version="${version#v}"But
MISE_CURRENT_VERSIONis rendered from the release tag form and still includes thevprefix.That means current-version checks never match, so the installer always falls back to the non-current-version path.
In practice, this bypasses:
Changes
MISE_CURRENT_VERSIONinto a localcurrent_versioninget_checksum()MISE_CURRENT_VERSIONinto a localcurrent_versionininstall_mise()install.shversion literal unchanged and only fix the comparisonsThis intentionally avoids changing the rendered
install.shformat. Bothversionandcurrent_versionundergo the same#vstrip; if you'd prefer, I can follow up by renaming both to make the normalized semantics more explicit.