Skip to content

xvm: release 0.0.5 - #108

Merged
Sunrisepeak merged 13 commits into
mainfrom
xvm_0.0.5
Aug 16, 2025
Merged

Sunrisepeak merged 13 commits into
mainfrom
xvm_0.0.5

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member
  1. add shim type: bin, lib, ...
  2. update versiondb structure

1. fix _serialize for indexstore
2. xvm use: change exit code from 1 -> 0 for not found
3. adapt xvm 0.0.5: add use / has / log_tag
4. optimize logic for installed (xvm list -> xvm info

Signed-off-by: sunrisepeak <[email protected]>
@Sunrisepeak
Sunrisepeak merged commit 1292cf1 into main Aug 16, 2025
Sunrisepeak added a commit that referenced this pull request May 2, 2026
The xlings E2E test fixture is dynamically cloned from xim-pkgindex
main at CI time. xim-pkgindex#108 (declare runtime deps on
cmake/mdbook/ninja/node/xmake) introduced bare-name deps that cascade
into ambiguity errors in E2E-05's dual-mount scenario, plus exposed
latent issues (gcc-specs-config not auto-activated, node not finding
libstdc++ at runtime).

Pin XIM_PKGINDEX_REF to commit 9cb6982 (PR #106 merge — last commit
before #108) until those cascading issues stabilize. This restores the
previously-passing E2E green state and decouples xlings's release CI
from in-flight xim-pkgindex churn.

Bump after xim-pkgindex deps stabilize: namespace prefixes universal
(continuation of #110/#111), runtime lib closure verified (gcc's
lib64 actually reaches consumers' RPATH), and gcc-specs-config
activation pathway sorted out.

Applied to all four workflows that clone the fixture: xlings-ci-linux,
xlings-ci-macos, xlings-ci-windows, release.
Sunrisepeak added a commit that referenced this pull request May 2, 2026
Bind XIM_PKGINDEX_REF time-matched with BOOTSTRAP_XLINGS_VERSION=v0.4.8
(xlings released 2026-04-30 18:25 UTC, this commit lands 2026-04-30
17:43 UTC — last xim-pkgindex commit before 0.4.8 went live, so the
schema/conventions match what 0.4.8 expects).

Decouples xlings CI from in-flight xim-pkgindex churn (post #107: bare-
name deps + new runtime-dep declarations on prebuilts cascading into
E2E-05's dual-mount scenario). Bump in lockstep with BOOTSTRAP_XLINGS
once both stabilize.

Applied to all four workflows that clone the fixture: xlings-ci-linux,
xlings-ci-macos, xlings-ci-windows, release.
Sunrisepeak added a commit that referenced this pull request May 2, 2026
* release: 0.4.13 — fix(elfpatch): patchelf op order workaround

Bumps VERSION 0.4.12 → 0.4.13 + add_requires("mcpplibs-xpkg 0.0.37").

Hotfix for a patchelf 0.18.0 corruption bug that surfaced production-
wide after xim-pkgindex#108 declared `runtime = { glibc, gcc }` deps
on five common prebuilt packages (cmake, mdbook, ninja, node, xmake).
Predicate-driven elfpatch then fired on these binaries; for compact
ELFs (~≤ 280 KB, e.g. ninja 1.12.1 at 273 KB) patchelf 0.18.0 has an
order-sensitive corruption bug: --set-interpreter before --set-rpath
shifts the dynamic section so the subsequent rpath op writes through
DT_NEEDED, segfaulting the binary at execve+1 with no recovery.

mcpplibs-xpkg v0.0.37 reverses the op order in
_patch_elf_executables and _patch_elf fallback so --set-rpath runs
first. Linux-only fix; macOS / Windows unaffected (different
toolchains, no equivalent issue).

Symptom on 0.4.12:
    $ xlings install ninja
    $ ninja --version
    Segmentation fault (core dumped)
    # OR
    $ cmake ...                    # cmake driving small build tools
    failed(-1) — child process killed by signal

Symptom on 0.4.13 (verified locally with isolated XLINGS_HOME):
    $ xlings install ninja
    elfpatch._apply: source=predicate:single
    ninja: elfpatch auto: 1 1 0
    $ ninja --version
    1.12.1
    INTERP=…/xim-x-glibc/2.39/lib64/ld-linux-x86-64.so.2
    RUNPATH=…/xim-x-glibc/lib64:…/xim-x-gcc/lib64:…/subos/default/lib

Migration: 0.4.12 → 0.4.13 is binary-compatible. The in-place
self-update path (xself install / quick_install) handles the upgrade.
After upgrade, packages affected by xim-pkgindex#108 (cmake / mdbook /
ninja / node / xmake) need a re-install via `xlings uninstall <pkg> &&
xlings install <pkg>` to rebuild the corrupted payload — `xlings
install` alone won't re-patch already-installed payloads (correct
"installed payload is sacred" behavior, see installer.cppm:1080).
For the auto-recovery path (broken payload silently re-patched on
next install), see TODO in upstream tracking.

Verified locally:
  - libxpkg unit tests 27/27 pass (post-fix, includes new
    ApplyElfpatchAuto_LinuxRpathBeforeInterpreter regression test)
  - E2E in isolated XLINGS_HOME: ninja install with new predicate +
    new order produces a working binary, INTERP / RUNPATH correctly
    set, `ninja --version` exits 0

libxpkg PR: openxlings/libxpkg#13 (merged, v0.0.37)
Analysis: docs/plans/2026-05-03-patchelf-order-bug-analysis.md (in libxpkg)
mcpplibs-index: mcpplibs/mcpplibs-index@bc4f740 registers v0.0.37

* ci: retrigger after xim-pkgindex#110 merge

* ci: retrigger after xim-pkgindex#111 (comprehensive namespace deps)

* ci: pin XIM_PKGINDEX_REF to stable commit (pre-#108) for fixture clone

The xlings E2E test fixture is dynamically cloned from xim-pkgindex
main at CI time. xim-pkgindex#108 (declare runtime deps on
cmake/mdbook/ninja/node/xmake) introduced bare-name deps that cascade
into ambiguity errors in E2E-05's dual-mount scenario, plus exposed
latent issues (gcc-specs-config not auto-activated, node not finding
libstdc++ at runtime).

Pin XIM_PKGINDEX_REF to commit 9cb6982 (PR #106 merge — last commit
before #108) until those cascading issues stabilize. This restores the
previously-passing E2E green state and decouples xlings's release CI
from in-flight xim-pkgindex churn.

Bump after xim-pkgindex deps stabilize: namespace prefixes universal
(continuation of #110/#111), runtime lib closure verified (gcc's
lib64 actually reaches consumers' RPATH), and gcc-specs-config
activation pathway sorted out.

Applied to all four workflows that clone the fixture: xlings-ci-linux,
xlings-ci-macos, xlings-ci-windows, release.

* ci: support commit-SHA refs in prepare_fixture_index.sh

`git clone --branch` only accepts branch/tag names, not SHAs. When
XIM_PKGINDEX_REF is set to a commit SHA (40-char hex), do a full clone
then `git checkout <sha>`. Branch/tag refs continue to use the depth-1
shallow clone path.

* ci: pin XIM_PKGINDEX_REF to stable commit (pre-#108) for fixture clone

Bind XIM_PKGINDEX_REF time-matched with BOOTSTRAP_XLINGS_VERSION=v0.4.8
(xlings released 2026-04-30 18:25 UTC, this commit lands 2026-04-30
17:43 UTC — last xim-pkgindex commit before 0.4.8 went live, so the
schema/conventions match what 0.4.8 expects).

Decouples xlings CI from in-flight xim-pkgindex churn (post #107: bare-
name deps + new runtime-dep declarations on prebuilts cascading into
E2E-05's dual-mount scenario). Bump in lockstep with BOOTSTRAP_XLINGS
once both stabilize.

Applied to all four workflows that clone the fixture: xlings-ci-linux,
xlings-ci-macos, xlings-ci-windows, release.

* ci: use full 40-char SHA for XIM_PKGINDEX_REF (regex match)
Sunrisepeak added a commit that referenced this pull request May 2, 2026
CI 4th attempt with main HEAD (3f1462d) failed: post-#108 pkgindex
schema needs hooks that v0.4.13 doesn't yet wire up:
  - gcc-specs-config (added in #109) doesn't auto-activate; gcc's
    config hook fails 'no version set for gcc-specs-config'
  - node has runtime dep on xim:gcc but its rpath closure misses
    gcc's libstdc++ subdir → libstdc++.so.6 not found

These need fixes in either xlings (resolver/config hook ordering)
or xim-pkgindex (gcc-specs-config registration / lib paths) — both
out of scope for this CI bump.

Pin XIM_PKGINDEX_REF back to 83044b5 (verified known-good for v0.4.13
during PR #257 release CI). Future bump: in lockstep with the next
xlings release that supports post-#108 schema.
Sunrisepeak added a commit that referenced this pull request May 2, 2026
* ci: bump bootstrap xlings v0.4.8 → v0.4.13 + xim-pkgindex pin

Co-bump BOOTSTRAP_XLINGS_VERSION and XIM_PKGINDEX_REF across all four
workflows that clone the fixture (xlings-ci-linux, xlings-ci-macos,
xlings-ci-windows, release).

  BOOTSTRAP_XLINGS_VERSION: v0.4.8 → v0.4.13
  XIM_PKGINDEX_REF: 83044b5 (pre-#108) → 3f1462d (xim-pkgindex main
                                          tip as of v0.4.13)

Why co-bump: the bootstrap xlings's resolver / elfpatch / catalog
behavior must match the pkgindex schema (legacy deps array vs new
runtime/build split, namespace conventions, exports.runtime.loader,
etc.). Bumping one without the other risks an in-flight pkgindex
breaking a stable bootstrap or vice versa — exactly what happened
during the 0.4.13 hotfix sequence (xim-pkgindex#108 added bare-name
deps that 0.4.8's resolver couldn't disambiguate, cascading through
E2E-05 dual-mount).

v0.4.13 contains the elfpatch op-order fix (libxpkg PR #13 / v0.0.37)
and pairs with xim-pkgindex 3f1462d (PRs #110/#111 namespace fixes
applied). Both refs verified together via PR #257's CI.

The earlier fixture-pin comment is reframed: it's not a one-off
workaround but a permanent bump-in-lockstep policy.

* ci: revert XIM_PKGINDEX_REF to 83044b5 (last known-good vs v0.4.13)

CI 4th attempt with main HEAD (3f1462d) failed: post-#108 pkgindex
schema needs hooks that v0.4.13 doesn't yet wire up:
  - gcc-specs-config (added in #109) doesn't auto-activate; gcc's
    config hook fails 'no version set for gcc-specs-config'
  - node has runtime dep on xim:gcc but its rpath closure misses
    gcc's libstdc++ subdir → libstdc++.so.6 not found

These need fixes in either xlings (resolver/config hook ordering)
or xim-pkgindex (gcc-specs-config registration / lib paths) — both
out of scope for this CI bump.

Pin XIM_PKGINDEX_REF back to 83044b5 (verified known-good for v0.4.13
during PR #257 release CI). Future bump: in lockstep with the next
xlings release that supports post-#108 schema.
Sunrisepeak added a commit that referenced this pull request May 3, 2026
…e fixes) (#260)

End-to-end CI verification of the full chain that landed across recent
xlings + xim-pkgindex work:

xim-pkgindex bumps from 83044b5 (pre-#108) to 19f4383 (main HEAD), now
includes:
  * #110/#111: namespace all bare-name deps (cmake/ninja/xmake/gcc/
    binutils/openssl/d2x → xim: prefix), removes dual-mount ambiguity
  * #116: split xim:gcc-runtime as a standalone xpkg (~25 MB)
    containing libstdc++/libgcc_s/libgomp/etc — vs full xim:gcc compiler
    (~1.1 GB)
  * #117: switch ninja/node/mdbook from xim:gcc to xim:gcc-runtime, so
    consumer rpath closure pulls only the runtime libs they need
  * #118: gcc-runtime declares `exports.runtime.libdirs = { "lib64" }`
    (correct schema field, was incorrectly `abi = {...}` in #116)

Pairs with xlings's:
  * 0.4.13 release: patchelf op order fix (no compact-ELF corruption)
  * post-merge PR #259: load_project_config_ falls through to
    XLINGS_PROJECT_DIR env after a projectScope:false skip (without
    this fix, gcc-specs-config shim spawned from gcc.config hook
    couldn't resolve its workspace version because the cwd traversal
    hit the xlings repo's own projectScope:false .xlings.json)

Together these enable E2E-05 (Fixed Project Scenarios) to exercise
the full predicate-driven elfpatch + script-as-runtime-dep flow on
Linux without the workarounds the previous pin (83044b5) was
sidestepping.

If CI is green, the temporary pin can stay (now bumped) — or be
removed entirely once we trust both sides' main to evolve in lockstep.
Sunrisepeak added a commit that referenced this pull request May 3, 2026
#261)

* ci: bump XIM_PKGINDEX_REF 83044b5 → 19f4383 (gcc-runtime + lib closure fixes)

End-to-end CI verification of the full chain that landed across recent
xlings + xim-pkgindex work:

xim-pkgindex bumps from 83044b5 (pre-#108) to 19f4383 (main HEAD), now
includes:
  * #110/#111: namespace all bare-name deps (cmake/ninja/xmake/gcc/
    binutils/openssl/d2x → xim: prefix), removes dual-mount ambiguity
  * #116: split xim:gcc-runtime as a standalone xpkg (~25 MB)
    containing libstdc++/libgcc_s/libgomp/etc — vs full xim:gcc compiler
    (~1.1 GB)
  * #117: switch ninja/node/mdbook from xim:gcc to xim:gcc-runtime, so
    consumer rpath closure pulls only the runtime libs they need
  * #118: gcc-runtime declares `exports.runtime.libdirs = { "lib64" }`
    (correct schema field, was incorrectly `abi = {...}` in #116)

Pairs with xlings's:
  * 0.4.13 release: patchelf op order fix (no compact-ELF corruption)
  * post-merge PR #259: load_project_config_ falls through to
    XLINGS_PROJECT_DIR env after a projectScope:false skip (without
    this fix, gcc-specs-config shim spawned from gcc.config hook
    couldn't resolve its workspace version because the cwd traversal
    hit the xlings repo's own projectScope:false .xlings.json)

Together these enable E2E-05 (Fixed Project Scenarios) to exercise
the full predicate-driven elfpatch + script-as-runtime-dep flow on
Linux without the workarounds the previous pin (83044b5) was
sidestepping.

If CI is green, the temporary pin can stay (now bumped) — or be
removed entirely once we trust both sides' main to evolve in lockstep.

* feat(xself): implement `self uninstall` (-y / --keep-data / --dry-run)

Closes the long-standing gap where `xlings remove xim:xlings` refuses
single-version self-removal and routes the user to `self uninstall`,
but `self uninstall` didn't exist — the dispatcher silently fell
through to help and exited 0, making the command a footgun for
automation scripts.

## Semantics (vs `xlings remove xim:xlings`)

  - `xlings remove xim:xlings@VER` removes a single version; refuses
    when only one xlings version is installed (single-version guard
    pointing the user here)
  - `xlings self uninstall` is the escape hatch: removes the entire
    XLINGS_HOME (bin/, subos/, data/, config/, .xlings.json + the
    home dir itself), all installed packages, all subos. Lets the
    user fully tear down xlings even with a single version present.

## CLI

    xlings self uninstall [-y | --yes] [--keep-data] [--dry-run]

    -y / --yes      skip interactive [y/N] confirmation
    --keep-data     keep data/ (preserve pkg payloads for reinstall)
    --dry-run       print plan, change nothing

Exit codes:
    0  success / dry-run completed
    1  cancelled at prompt, safety refusal, or partial failure
    2  invalid invocation (unknown flag) — also fired by the bonus
       fix below for any unknown `xlings self <action>`

## Cross-platform self-deletion

  - Linux/macOS: kernel decouples open file from dirent, so the
    running xlings binary can be unlink'd in place. Process chdir's
    to "/" (or $TMPDIR) first so it doesn't end up with a dangling
    cwd inside the deleted tree.
  - Windows: a running .exe can't be deleted. Strategy: move
    xlings.exe to %TEMP%\xlings-pending-delete-<pid>.exe (same-volume
    rename works on a running exe), schedule that temp copy for
    delete-on-reboot. XLINGS_HOME is fully gone immediately; one
    cleanup file lingers in %TEMP% until restart. (TODO: route the
    actual MoveFileExW(MOVEFILE_DELAY_UNTIL_REBOOT) call through
    xlings.platform — for now the temp file is harmless until either
    reboot or manual cleanup.)

## Safety invariants

  1. Refuse when XLINGS_HOME canonicalizes to root, /usr, /etc, /home,
     a Windows system path, or exactly $HOME (without subdir suffix).
     Catches mis-set XLINGS_HOME from nuking /.
  2. Refuse when $XLINGS_HOME/.lock exists (another op in progress).
  3. Always print the deletion summary before doing anything, even
     with -y, so script logs capture what was removed.
  4. Best-effort: a single rm failure logs a warning and continues;
     final return code reflects total failures so the caller can
     react.

## What's preserved (default)

  - User shell rc files (~/.bashrc, ~/.zshrc, ~/.profile, fish config).
    We DETECT and PRINT lines that source xlings's profile so the user
    can manually clean them — never auto-edit (rc-file mutation is
    fragile + risks corrupting non-xlings content).
  - Project-local <project>/.xlings/ directories — user-owned.
  - ~/.xmake — not xlings-owned.

## Bonus: unknown-action non-zero exit

`xlings self bogus-action` previously fell through to the help screen
and exited 0 — bad signal for automation. Now returns exit 2 with an
explicit "unknown 'self' action" error message. Real help requests
(`xlings self`, `xlings self -h`, `xlings self --help`) keep returning
0 as before.

## Files

  - src/core/xself/uninstall.cppm   (new — cmd_uninstall + helpers)
  - src/core/xself.cppm             (router + help + unknown-action fix)
  - tests/e2e/self_uninstall_test.sh (new — 8 sub-scenarios)
  - .github/workflows/xlings-ci-linux.yml (wire E2E-02b)
  - docs/plans/2026-05-04-self-uninstall-design.md (design doc)

## Verified locally

  Build: xmake build xlings — ok in 15s
  Isolated XLINGS_HOME (separate from /home/speak/.xlings):
    T1 --dry-run -y                  → exit 0, files unchanged ✓
    T2 empty stdin (no confirm)      → exit 1, files unchanged ✓
    T3 bogus self action             → exit 2 ✓ (regression guard)
    T4 bogus uninstall flag          → exit 2 ✓
    T5 XLINGS_HOME=/                 → exit 1, refused ✓
    T6 XLINGS_HOME=$HOME             → exit 1, refused ✓
    T7 --keep-data -y                → exit 0; data/ preserved,
                                       bin/subos/config/.xlings.json
                                       gone ✓
    T8 full -y uninstall             → exit 0; XLINGS_HOME gone
                                       entirely ✓
  System /home/speak/.xlings: SHA + pkg count unchanged across all
  test runs (verified via baseline sha256 99e2660...).

  E2E test (tests/e2e/self_uninstall_test.sh) passes locally end-to-end.

* fix(xself): use const auto& in path iterator (clang strictness)
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