Skip to content

fix(installer): normalize current version before comparison#8649

Merged
jdx merged 1 commit intojdx:mainfrom
tak848:fix-installer-current-version
Mar 19, 2026
Merged

fix(installer): normalize current version before comparison#8649
jdx merged 1 commit intojdx:mainfrom
tak848:fix-installer-current-version

Conversation

@tak848
Copy link
Copy Markdown
Contributor

@tak848 tak848 commented Mar 18, 2026

Summary

  • Normalize the current version before standalone installer comparisons
  • Keep the rendered install.sh format unchanged

Problem

The standalone installer strips the leading v from the selected version before using it:

version="${version#v}"

But MISE_CURRENT_VERSION is rendered from the release tag form and still includes the v prefix.

That means current-version checks never match, so the installer always falls back to the non-current-version path.

In practice, this bypasses:

  • Embedded checksums for the current release
  • The current-release CDN tarball path

Changes

  • Normalize MISE_CURRENT_VERSION into a local current_version in get_checksum()
  • Normalize MISE_CURRENT_VERSION into a local current_version in install_mise()
  • Keep the public install.sh version literal unchanged and only fix the comparisons

This intentionally avoids changing the rendered install.sh format. Both version and current_version undergo the same #v strip; if you'd prefer, I can follow up by renaming both to make the normalized semantics more explicit.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 MISE_CURRENT_VERSION to remove its 'v' prefix, the installer can now correctly identify the current version, enabling proper utilization of embedded checksums and the current-release CDN tarball path. This ensures the installer behaves as expected for the current release without unintended fallbacks.

Highlights

  • Version Normalization: Normalized the MISE_CURRENT_VERSION variable by stripping its leading 'v' prefix before performing comparisons within the standalone installer script.
  • Installer Logic Fix: Corrected the logic in get_checksum() and install_mise() functions to ensure accurate version comparisons, preventing the installer from always falling back to non-current-version paths.
  • Preserved Format: Maintained the existing format of the rendered install.sh script, ensuring only the internal comparison logic was adjusted without altering public-facing version literals.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@tak848 tak848 marked this pull request as ready for review March 18, 2026 23:01
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 18, 2026

Greptile Summary

This 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 MISE_CURRENT_VERSION carries a v prefix (e.g. v2.10.1) while the installer strips that prefix from the working version variable, making the string comparison always fail.

Key changes:

  • In get_checksum(): adds a local current_version variable that strips the leading v from MISE_CURRENT_VERSION before comparing against the already-stripped version parameter.
  • In install_mise(): same normalisation — current_version is derived by stripping the v prefix from MISE_CURRENT_VERSION, so the version != current_version guard correctly identifies the current-release install path.
  • The public install.sh literal format is intentionally preserved; only the internal comparison variables change.

The fix is minimal, correct, and well-scoped — the ${var#v} parameter expansion is a no-op when the prefix is already absent, so the change is safe regardless of whether MISE_CURRENT_VERSION is emitted with or without the prefix in the future.

Confidence Score: 5/5

  • This PR is safe to merge — it is a targeted, low-risk bug fix with no functional regressions.
  • The change is confined to two small, symmetric patches in a single shell script template. Both patches follow the same well-established POSIX parameter-expansion idiom (${var#v}) already used elsewhere in the script. The logic is easy to verify: the installer already strips the v from version, so stripping it from MISE_CURRENT_VERSION into current_version before comparison is the correct and minimal fix. No new edge cases are introduced.
  • No files require special attention.

Important Files Changed

Filename Overview
packaging/standalone/install.envsubst Adds a local current_version variable (stripped of the v prefix) in both get_checksum() and install_mise() so that the v-stripped version variable is compared against an equally v-stripped copy of MISE_CURRENT_VERSION, fixing comparisons that previously always failed.

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
Loading

Last reviewed commit: "fix(installer): norm..."

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +113 to +114
current_version="$MISE_CURRENT_VERSION"
current_version="${current_version#v}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For conciseness, you can combine these two lines into a single line. This is a standard POSIX shell feature.

Suggested change
current_version="$MISE_CURRENT_VERSION"
current_version="${current_version#v}"
current_version="${MISE_CURRENT_VERSION#v}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment on lines +247 to +248
current_version="$MISE_CURRENT_VERSION"
current_version="${current_version#v}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For conciseness, you can combine these two lines into a single line. This is a standard POSIX shell feature.

Suggested change
current_version="$MISE_CURRENT_VERSION"
current_version="${current_version#v}"
current_version="${MISE_CURRENT_VERSION#v}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as above — envsubst constraint requires the two-line form.

@tak848
Copy link
Copy Markdown
Contributor Author

tak848 commented Mar 18, 2026

coverage-7 failure is unrelated to this PR — caused by Java EA version bump (26 → 27). Fix is tracked in #8634

@jdx jdx enabled auto-merge (squash) March 19, 2026 22:45
@jdx jdx disabled auto-merge March 19, 2026 22:46
@jdx jdx merged commit 7da7334 into jdx:main Mar 19, 2026
33 of 35 checks passed
jdx pushed a commit that referenced this pull request Mar 21, 2026
### 🐛 Bug Fixes

- **(config)** resolve trust hash collision for same-name directories by
@tdragon in [#8628](#8628)
- **(docs)** fix width of tools table by @himkt in
[#8625](#8625)
- **(docs)** prevent homepage hero atmosphere overflow by @nygmaaa in
[#8642](#8642)
- **(doctor)** detect PATH ordering issues when mise is activated by
@jdx in [#8585](#8585)
- **(git)** use origin as remote name by @bentinata in
[#8626](#8626)
- **(installer)** normalize current version before comparison by @tak848
in [#8649](#8649)
- **(lockfile)** Resolve symlink when updating lockfiles by @chancez in
[#8589](#8589)
- **(python)** verify checksums for precompiled binary downloads by
@malept in [#8593](#8593)
- **(rust)** resolve relative CARGO_HOME/RUSTUP_HOME to absolute paths
by @simonepri in [#8604](#8604)
- **(task)** correctly resolve task name for _default files with
extensions by @youta1119 in
[#8646](#8646)
- **(tasks)** global file tasks not properly marked as such by @roele in
[#8618](#8618)
- **(tasks)** handle broken pipe in table print and task completion
output by @vmaleze in [#8608](#8608)
- use dark/light logo variants in README for GitHub dark mode by @jdx in
[#8656](#8656)
- failing rebuild of runtime symlinks for shared tools by @roele in
[#8647](#8647)
- add spaces around current element operator in flutter version_expr by
@roele in [#8616](#8616)
- complete task arguments correctly by @KevSlashNull in
[#8601](#8601)

### 📚 Documentation

- switch body font to DM Sans and darken dark mode background by @jdx in
[6e3ad34](6e3ad34)
- use Cormorant Garamond for headers and Roc Grotesk for body text by
@jdx in
[010812a](010812a)
- resolve chaotic heading hierarchy in task-arguments.md by @muzimuzhi
in [#8644](#8644)

### 🧪 Testing

- fix test_java and mark as slow by @roele in
[#8634](#8634)

### 📦️ Dependency Updates

- update docker/dockerfile:1 docker digest to 4a43a54 by @renovate[bot]
in [#8657](#8657)
- update ghcr.io/jdx/mise:alpine docker digest to 2584470 by
@renovate[bot] in [#8658](#8658)

### 📦 Registry

- add viteplus (npm:vite-plus) by @risu729 in
[#8594](#8594)
- remove backend.options for podman by @roele in
[#8633](#8633)
- add pi.dev coding agent by @dector in
[#8635](#8635)
- add ormolu ([github:tweag/ormolu](https://github.com/tweag/ormolu)) by
@3w36zj6 in [#8617](#8617)
- use version_expr for dart and sort versions by @roele in
[#8631](#8631)

### New Contributors

- @bentinata made their first contribution in
[#8626](#8626)
- @tdragon made their first contribution in
[#8628](#8628)
- @nygmaaa made their first contribution in
[#8642](#8642)
- @youta1119 made their first contribution in
[#8646](#8646)
- @chancez made their first contribution in
[#8589](#8589)
- @dector made their first contribution in
[#8635](#8635)
- @tak848 made their first contribution in
[#8649](#8649)

## 📦 Aqua Registry Updates

#### New Packages (5)

- [`acsandmann/rift`](https://github.com/acsandmann/rift)
-
[`alltuner/mise-completions-sync`](https://github.com/alltuner/mise-completions-sync)
- [`berbicanes/apiark`](https://github.com/berbicanes/apiark)
-
[`gitlab.com/graphviz/graphviz`](https://github.com/gitlab.com/graphviz/graphviz)
-
[`jorgelbg/pinentry-touchid`](https://github.com/jorgelbg/pinentry-touchid)

#### Updated Packages (7)

- [`UpCloudLtd/upcloud-cli`](https://github.com/UpCloudLtd/upcloud-cli)
- [`aquaproj/registry-tool`](https://github.com/aquaproj/registry-tool)
- [`go-swagger/go-swagger`](https://github.com/go-swagger/go-swagger)
-
[`gopinath-langote/1build`](https://github.com/gopinath-langote/1build)
- [`sassman/t-rec-rs`](https://github.com/sassman/t-rec-rs)
- [`sharkdp/fd`](https://github.com/sharkdp/fd)
- [`temporalio/cli`](https://github.com/temporalio/cli)
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.

3 participants