fix(musl-gcc): anchor the gcc-flavor root at the flavor version - #428
Merged
Conversation
Both musl gcc recipes register a virtual root for their flavor subtree with a
bare `xvm.add(root_name)`, then bind every child to `<root_name>@<flavor_ver>`.
`xvm.add()` defaults `version` to `pkginfo.version()`, so the root actually
created is `<root_name>@16.1.0` while the children name
`<root_name>@16.1.0-musl` — a different exact node. The root they point at was
never registered.
xlings 2026.7.27.1 validates this and rejects the whole batch:
error: registration binding root is not an exact batch node
code: xvm-binding-root-missing
provider: xim:musl-gcc@16.1.0
at: xim-musl-gnu-gcc@16.1.0-musl
field: /nodes/37/binding
which surfaces to the user as `[musl-gcc] failed: config hook failed` and makes
`xlings install musl-gcc` exit 1.
gcc.lua uses the same bare form without trouble only because its children bind
to `xim-gnu-gcc@<pkginfo.version()>` — exactly what the default fills in. The
musl recipes' flavor suffix breaks that coincidence; the bug has been latent
since the flavor root was introduced and only became visible once xlings
started checking.
`__unregister_gcc_flavor` had the mirror image of the same mistake: it removed
the bare root, i.e. `<root>@<pkginfo.version()>`, never the node that was
created. Now versioned to match.
Verified against xlings 2026.7.27.2 with musl-gcc@15.1.0:
before: `xlings install musl-gcc@15.1.0 -y` → xvm-binding-root-missing,
config hook failed
after: installs clean (exit 0); `musl-gcc --version` reports
x86_64-linux-musl-gcc (GCC) 15.1.0 and `musl-gcc -static` compiles
and runs a binary
Swept the rest of the index for the same shape: every other recipe with a
binding builds it as `package.name .. "@" .. pkginfo.version()`, which matches
the default, so these two are the only ones affected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
两个 musl gcc 配方用裸
xvm.add(root_name)锚定 flavor 子树的虚拟根,然后把每个子节点绑定到<root_name>@<flavor_ver>。xvm.add()的version默认取pkginfo.version(),所以实际创建的根是<root_name>@16.1.0,而子节点指向的是<root_name>@16.1.0-musl—— 两个不同的精确节点。子节点指向的那个根从未被注册。xlings
2026.7.27.1开始校验这一点并整批拒绝:对用户呈现为
[musl-gcc] failed: config hook failed,xlings install musl-gcc退出 1。gcc.lua用同样的裸写法却没事,只是因为它的子节点绑定到xim-gnu-gcc@<pkginfo.version()>—— 恰好就是默认值填进去的那个。musl 配方的 flavor 后缀打破了这个巧合。这个 bug 自 flavor root 引入起就潜伏着,只是直到 xlings 开始检查才显形。__unregister_gcc_flavor犯了对称的错误:它移除的是裸根(即<root>@<pkginfo.version()>),从来不是真正创建的那个节点。一并改为带版本。验证(xlings 2026.7.27.2 + musl-gcc@15.1.0)
修复前:
修复后:
影响面
全索引扫过一遍同型写法:其余带
binding的配方都把它构造成package.name .. "@" .. pkginfo.version(),与默认值一致,因此只有这两个受影响。上下文
发现于 mcpp 把 xlings pin 从
0.4.69升到2026.7.27.2(mcpp-community/mcpp#292),CI 的toolchain: musl + llvm与两个 linux e2e 分片因此变红。合入本 PR 后那条链路才能通。