Skip to content

fix(installer): guard zstd archive selection on zstd binary availability#8460

Merged
jdx merged 1 commit intojdx:mainfrom
octo:zstd
Mar 4, 2026
Merged

fix(installer): guard zstd archive selection on zstd binary availability#8460
jdx merged 1 commit intojdx:mainfrom
octo:zstd

Conversation

@octo
Copy link
Copy Markdown
Contributor

@octo octo commented Mar 4, 2026

tar_supports_zstd() returned true for GNU tar >= 1.31 regardless of whether the zstd binary was present, causing extraction to fail on systems where tar shells out to zstd rather than linking against it. Fix by checking zstd availability upfront before any tar version check.

Also remove the fallback branch in get_ext() that selected a zstd archive even when tar_supports_zstd() returned false, which could cause the same extraction failure on unrecognized tar versions.

Fixes: #8458

`tar_supports_zstd()` returned `true` for GNU tar >= 1.31 regardless of whether
the zstd binary was present, causing extraction to fail on systems where tar
shells out to zstd rather than linking against it. Fix by checking zstd
availability upfront before any tar version check.

Also remove the fallback branch in `get_ext()` that selected a zstd archive
even when `tar_supports_zstd()` returned false, which could cause the same
extraction failure on unrecognized tar versions.

Fixes: jdx#8458
@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 resolves an issue where the installer might attempt to use zstd compressed archives (.tar.zst) even when the zstd compression utility is not present on the system, leading to installation failures. The changes ensure that the system explicitly verifies the availability of the zstd binary before opting for zstd archives, significantly improving the reliability and robustness of the installation process.

Highlights

  • Zstd Binary Availability Check: Prioritized checking for the zstd binary's presence within the tar_supports_zstd() function. This ensures that .tar.zst archives are only selected if the zstd utility is actually available on the system, preventing extraction failures.
  • Redundant Zstd Check Removal: Removed a redundant zstd availability check from the get_ext() function. The logic now solely relies on tar_supports_zstd() to determine if tar.zst should be used, streamlining the archive selection process.
Changelog
  • packaging/standalone/install.envsubst
    • Modified the tar_supports_zstd function to first verify the presence of the zstd binary before checking tar version or type.
    • Removed a redundant zstd availability check from the get_ext function.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 4, 2026

Greptile Summary

Fixed installer failure on systems where tar shells out to zstd instead of linking against it. The issue occurred when GNU tar >= 1.31 was present but the zstd binary was missing.

Changes:

  • Added upfront zstd binary availability check in tar_supports_zstd() before any tar version detection
  • Removed fallback branch in get_ext() that could incorrectly select zstd archives when tar_supports_zstd() returned false

Impact:
The installer now correctly falls back to tar.gz archives when zstd is unavailable, preventing extraction failures. The logic ensures zstd archives are only selected when both tar supports zstd AND the zstd binary is present.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The fix correctly addresses a specific installer failure with minimal, well-reasoned changes. The logic is sound: checking zstd availability before selecting zstd archives prevents extraction failures. No new edge cases or bugs are introduced.
  • No files require special attention

Important Files Changed

Filename Overview
packaging/standalone/install.envsubst Added upfront zstd binary check in tar_supports_zstd() and removed problematic fallback in get_ext() that could select zstd archives when tar doesn't support them

Last reviewed commit: c48ff2b

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

The pull request effectively addresses the issue where tar.zst archives were being selected and attempted even when the zstd binary was not available, leading to extraction failures. The changes correctly prioritize checking for zstd binary availability before determining if tar supports zstd archives, and removes the problematic fallback logic in get_ext(). This significantly improves the robustness of the installer.

I am having trouble creating individual review comments. Click here to see my feedback.

packaging/standalone/install.envsubst (84-85)

critical

Introducing an explicit check for zstd binary availability at the beginning of tar_supports_zstd() is an excellent and necessary change. This ensures that tar.zst is only considered if the zstd command is actually present on the system, preventing extraction failures when tar relies on an external zstd binary.

packaging/standalone/install.envsubst (78-79)

high

The removal of this elif block in get_ext() is a crucial improvement. Previously, this allowed tar.zst to be selected solely based on zstd binary availability, even if tar_supports_zstd (which now correctly includes the zstd check) would have returned false. This change prevents attempting to extract tar.zst with an incompatible tar version.

packaging/standalone/install.envsubst (87)

medium

The modification to remove the && command -v zstd >/dev/null 2>&1 from this condition is correct. With the new upfront check for zstd availability (lines 84-85), this redundant check is no longer needed here, simplifying the logic.

@NiklasRosenstein
Copy link
Copy Markdown

NiklasRosenstein commented Mar 4, 2026

Would love to see this merged ASAP. The current state breaks our release build 😄 .

@kornpow
Copy link
Copy Markdown

kornpow commented Mar 4, 2026

Also looking forward to the fix! Builds be broken 😭

@jdx jdx merged commit b9f8338 into jdx:main Mar 4, 2026
35 checks passed
@NiklasRosenstein
Copy link
Copy Markdown

Thanks for the quick turnaround @octo @jdx 🚀

@danmoz
Copy link
Copy Markdown

danmoz commented Mar 4, 2026

Thanks for the quick fix.

How long will it tak mise.run to update, do you think?

UPDATE: aha, found the release pipeline.

@octo octo deleted the zstd branch March 5, 2026 06:45
TimDiekmann added a commit to hashintel/hash that referenced this pull request Mar 5, 2026
Bump mise from 2026.1.12 to 2026.3.3 which fixes the standalone
installer's zstd archive selection on systems without zstd installed
(jdx/mise#8460). Also pin MISE_INSTALL_EXT=tar.gz as a safeguard
against future installer regressions.
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.

5 participants