fix: resolve shim alias to full path, preventing self-recursion#207
Merged
Sunrisepeak merged 3 commits intomainfrom Mar 15, 2026
Merged
fix: resolve shim alias to full path, preventing self-recursion#207Sunrisepeak merged 3 commits intomainfrom
Sunrisepeak merged 3 commits intomainfrom
Conversation
When a shim alias (e.g. "gcc --sysroot=...") is executed via platform::exec(), the bare program name could resolve back to the shim itself through PATH, causing infinite recursion up to depth=8. Now the alias command's first word is resolved to its full path via resolve_executable() before execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…>= 8 Normal alias execution keeps original behavior (bare command via PATH). When depth reaches MAX_SHIM_DEPTH (8), log diagnostic info (program, alias, package path, PATH) and resolve alias to full path as fallback. Hard stop at FALLBACK_DEPTH (10) if resolution still fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… sync - add_version() now accepts binding param and establishes bidirectional binding relationships (parent↔child) in VInfo.bindings - installer passes op.binding through to add_version - cmd_use recursively traverses binding tree to sync all connected targets' workspace versions (e.g., `xlings use gcc 15` syncs g++, gcc-ar, cc automatically) - Remove runtime binding lookup in shim_dispatch; each binding target now has its own workspace version set by cmd_use Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
resolve_executable()fallback 将 alias 解析为完整路径Root Cause
alias 分支构建的 PATH 顺序为:
package 目录排在 shim_dir 之前,正常安装时真实二进制优先被找到,不会递归。
递归仅在异常条件下触发(真实二进制缺失,PATH 回退到 shim_dir):
Changes
src/core/xvm/shim.cppmtests/unit/test_main.cppResolveAliasCommandToFullPath和ResolveAliasDirectPath测试tests/e2e/shim_alias_recursion_test.shdocs/plans/2026-03-15-shim-alias-recursion-fix.mdTest plan
xmake build— 编译通过xmake run xlings_tests— 196 tests passedbash tests/e2e/shim_alias_recursion_test.sh— E2E 测试gcc --version🤖 Generated with Claude Code