Skip to content

Fix duplicated eabihf suffix in ARMv7 platform triples#19139

Closed
nooscraft wants to merge 2 commits intoastral-sh:mainfrom
nooscraft:bugfix/19137
Closed

Fix duplicated eabihf suffix in ARMv7 platform triples#19139
nooscraft wants to merge 2 commits intoastral-sh:mainfrom
nooscraft:bugfix/19137

Conversation

@nooscraft
Copy link
Copy Markdown
Contributor

Fixes uv self update on ARMv7 Linux hosts where the generated platform string ended up with eabihf twice:

armv7-unknown-linux-gnueabihfeabihf

The issue was that Platform::as_cargo_dist_triple() always appended eabihf for ARMv7 Linux, even when libc detection already returned Gnueabihf.

This adds a small guard so we only append eabihf when it is not already present. The existing soft-float Gnu path still gets the suffix as expected.

Added regression coverage for both cases.

Closes #19137.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 24, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing nooscraft:bugfix/19137 (13b038c) with main (3e9c333)

Open in CodSpeed

Copy link
Copy Markdown
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

One nit.

The approach here looks fine to me, but I'm not sure we actually need the {env}eabihf fallback anymore if the detected Environment consistently contains it. @nooscraft did you look into whether this is still sporadically possible?

Actually, the fact that we're doing this for multiple hf variants makes me think it'd be best to fully understand why we added this eabihf hack in the first place. I'll be looking at that more.

Comment thread crates/uv-platform/src/lib.rs Outdated
Comment on lines +166 to +173
let env_str = env.to_string();
// Only append "eabihf" if the environment doesn't already have it
// (e.g., `Gnueabihf` already ends with "eabihf", but `Gnu` doesn't)
if env_str.ends_with("eabihf") {
env_str
} else {
format!("{env}eabihf")
}
Copy link
Copy Markdown
Member

@woodruffw woodruffw Apr 25, 2026

Choose a reason for hiding this comment

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

Can we push this up? The condition here should be if matches!(...) && matches!(env, target_lexicon::Environment::Eabihf | ...) rather than a nested one.

@woodruffw
Copy link
Copy Markdown
Member

Okay, I looked into this a bit more and I'm pretty there's a larger and nontrivial concern here:

  • The original, underlying problem is that we're appending eabihf unconditionally on armv7 variants. This was already incorrect, but probably went unnoticed for a long time because it was only affecting the uv format upgrade pathway.
  • Resolve official uv self-update versions before axoupdater #18674 changed that by using the same as_cargo_dist_triple logic that's used in the uv format upgrade pathway as part of uv's own upgrade logic, surfacing the long-standing bug on a hotter pathway.

In the happy path, this means we can probably just remove the eabihf append and things will work correctly for the gnu* case. However, that won't work for the musl* case, since our Libc::from_env detection currently only returns the base Musl variant rather than doing FP detection. It also won't work for the (probably rare) bare Gnu case, which can happen if FP detection fails (e.g. during reading/parsing /proc/cpuinfo).

I think the fix to the above is to properly emit Musleabi and Musleabihf variants in Libc::from_env, similarly to how gnu* detection works. Then, for the bare Gnu and Musl cases (FP detection failure), we can silently append the eabihf suffix (maybe with a warning to the user).

This will still be wrong for soft-float ARMv7 hosts that fail FP detection, but that's the existing behavior anyways (and is probably okay given how uncommon those are in 2026). It'll also be more correct for any unicorns out there running ARMv7 softfloat + musl, since they'll get an explicit matching failure rather than silently being given a hardfloat binary that'll SIGILL.

One wrinkle with the above though: fixing it at the Libc layer means that it'll affect PBS installation keys as well, so anybody on ARMv7+musl will start getting -musleabihf paths instead of -musl ones. I suspect that'll cause confusion if the host has other, older versions of uv installed, since those older versions won't be able to "see" the corrected paths. I'm not sure if this matters in practice.

TL;DR: I think this PR acts as a hotfix, but there's a larger (and more general) way we should probably handle this at the libc detection layer/in the Libc::from_env API.

@nooscraft
Copy link
Copy Markdown
Contributor Author

I saw #19157 and agree that handling this at the Libc::from_env layer is the more complete fix.

I’ve force-pushed the inline-comment refactor here using the typed match guard for Gnueabihf | Musleabihf | Eabihf, and added the Musleabihf regression test by constructing the variant directly, since Libc::from_str doesn’t parse musleabihf today. Happy to defer to you on whether it’s worth keeping this PR open as the focused hotfix, or whether I should close it in favor of #19157.

@woodruffw woodruffw closed this in 7e54e9d Apr 27, 2026
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.

Unable to use uv self update on armv7 host after 0.11.0

2 participants