fix(windows): selfContained detection false positive from subos shim#301
Merged
Conversation
783b7a5 to
7381d6a
Compare
…path
On Windows, shims in subos/current/bin/ are hardlinks or copies (not
symlinks like Unix). get_executable_path() returns the shim path, and
the parent-of-parent subos directory has both .xlings.json and
bin/xlings.exe — falsely matching the selfContained detection pattern.
This caused homeDir to be set to the subos directory instead of
~/.xlings, breaking all subsequent operations (versions DB, workspace,
shim creation paths).
Fix: use `if constexpr (platform::OS_NAME == "windows")` to add a
compile-time guarded content check — verify that the candidate
.xlings.json contains both "version" and "activeSubos" fields (written
by `self install`). Subos .xlings.json only has {"workspace":{}}, so
the dual-field check reliably distinguishes the two cases. Linux/macOS
pay zero overhead since shim symlinks resolve correctly.
Also replaces the #ifdef _WIN32 for binary name detection with a
constexpr ternary on platform::OS_NAME, converging platform branching
into the platform module.
Bump version to 0.4.39.
7381d6a to
a8c88f8
Compare
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
subos/current/bin/xlings.exe(shim) triggers false selfContained detection, settinghomeDirtosubos/current/instead of~/.xlings/. This breaks global installs, version tracking, and shim creation.get_executable_path()returns the shim path. The subos directory has both.xlings.jsonandbin/xlings.exe, matching the selfContained pattern.subos— real selfContained packages are never nested undersubos/.Design doc
See
.agents/docs/2026-05-22-selfcontained-detection-windows-bug.mdTest plan
xlings install <pkg> -g && <pkg> --versionshould pass