Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(libc): 'gnu' should never mean 'none' on 'linux' #11

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

coolaj86
Copy link
Member

@coolaj86 coolaj86 commented Sep 11, 2024

Problem

bat has packages that are explicitly marked as gnu, but are being erroneously detected as libc:none, the same as the musl packages.

History

Unexpectedly, gnu is a very ambiguous term. It's usually only used to identify windows packages as non-msvc (libc:none), or some specific build of arm (e.g. el, hf).

Linux is implicitly gnu if not explicitly musl (Alpine) or bionic (Android).

However, many modern tools don't use gnu (i.e. Go, Zig), so when not specified Linux is implicitly none.

HOWEVER, when Linux specifies gnu, it's explicitly libc:gnu, not libc:none.

Solution

Since this would currently be the only member of a 3rd tier terms list, it's instead added as a special case for identifying the architecture of a package.

Other considerations

This is tricky no matter which way we slice it because some musl packages rely on musl's libc++ (such as node.js), so we can't just mark all musl packages as libc:musl and have libc:musl preferred over libc:none or libc:gnu automatically.

Likewise, explicit gnu packages almost always linking against other gnu packages (at least libc) and almost never work on musl.

There's also the possibility to detect that if one package is marked as musl and another is not marked as gnu that we could cross-compare packages to mark it as gnu. However, I think that's too complex - that type of tagging should just be handled in the installer's releases.js itself.

@coolaj86 coolaj86 merged commit e12ec32 into main Sep 11, 2024
3 checks passed
@coolaj86 coolaj86 deleted the fix-linux-gnu branch September 11, 2024 22:57
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.

1 participant