Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(bun): improve musl detection logic using runtime detection#10195

Merged
jdx merged 1 commit into
jdx:mainfrom
roele:issues/10185
Jun 2, 2026
Merged

fix(bun): improve musl detection logic using runtime detection#10195
jdx merged 1 commit into
jdx:mainfrom
roele:issues/10185

Conversation

@roele

@roele roele commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Fixes an issue with glibc fallback for bun as mentioned in #10185

Summary by CodeRabbit

  • Bug Fixes
    • Improved platform detection in the Bun plugin: when system libc preference is unset, the tool now uses runtime detection and treats unknown results as non-musl. This reduces incorrect musl assumptions and improves compatibility across Linux environments.

Copilot AI review requested due to automatic review settings June 1, 2026 17:13
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 847c74b6-19df-4c58-9502-7ed44f63151e

📥 Commits

Reviewing files that changed from the base of the PR and between b251a03 and d268fd0.

📒 Files selected for processing (1)
  • src/plugins/core/bun.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/plugins/core/bun.rs

📝 Walkthrough

Walkthrough

The Bun plugin imports runtime libc detection (detect_libc) and updates BunPlugin::is_musl() to call it when Settings::get().libc() is unset, treating failed detection as non-musl instead of using compile-time checks.

Changes

Bun musl detection enhancement

Layer / File(s) Summary
Bun musl detection using runtime libc detection
src/plugins/core/bun.rs
Import detect_libc from the platform module and update BunPlugin::is_musl() to use detect_libc() at runtime when Settings::get().libc() is unset; unknown detection is considered non-musl rather than falling back to cfg!(target_env = "musl").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I’m a rabbit, sniffing the stack,
From compile flags I hop back,
I now check at runtime, keen and spry,
If musl whispers "yes" or lets it lie,
A tiny hop, a wiser track. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving musl detection logic in the bun plugin using runtime detection, which matches the core modification in src/plugins/core/bun.rs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Bun platform detection to better identify musl systems at runtime, improving release artifact selection.

Changes:

  • Switches is_musl() from compile-time target checks to runtime libc detection via detect_libc.
  • Consolidates imports to include detect_libc alongside existing checksum helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/core/bun.rs
@greptile-apps

greptile-apps Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes musl detection for the Bun plugin on Linux. Previously, the fallback path in BunPlugin::is_musl() used cfg!(target_env = "musl"), a compile-time constant that would always be false when mise itself was compiled for a glibc target — even if it was running on a musl system like Alpine. The fix replaces that with detect_libc() == Some("musl"), which uses the existing platform::detect_libc runtime detection logic.

  • The detect_libc() function already handles the gcompat/Alpine edge case by checking /etc/os-release before inspecting linker files, so the runtime detection is accurate across common Linux distributions.
  • On non-Linux platforms detect_libc() returns None, so the behaviour is unchanged there.

Confidence Score: 5/5

Safe to merge — a one-line logic change backed by an existing runtime detection function that already handles known edge cases.

The change swaps a baked-in compile-time assumption for the existing detect_libc() runtime check, which handles the Alpine + gcompat case, linker file inspection, and a compile-time fallback internally. Non-Linux behaviour is unchanged since detect_libc() returns None there.

No files require special attention.

Important Files Changed

Filename Overview
src/plugins/core/bun.rs Replaces compile-time cfg!(target_env = "musl") with runtime detect_libc() == Some("musl") in the is_musl() fallback; also consolidates two separate import lines into one.

Reviews (2): Last reviewed commit: "fix(bun): improve musl detection logic u..." | Re-trigger Greptile

Comment thread src/plugins/core/bun.rs Outdated
@jdx jdx merged commit b44c3b4 into jdx:main Jun 2, 2026
33 checks passed
@roele roele deleted the issues/10185 branch June 3, 2026 17:48
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