Skip to content

xvm: fix repeat save issue by set recursive_flag - #116

Merged
Sunrisepeak merged 2 commits into
mainfrom
xvm_optimize_repeat_save_issue
Aug 20, 2025
Merged

Sunrisepeak merged 2 commits into
mainfrom
xvm_optimize_repeat_save_issue

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

No description provided.

@Sunrisepeak
Sunrisepeak merged commit 9c26835 into main Aug 20, 2025
@Sunrisepeak
Sunrisepeak deleted the xvm_optimize_repeat_save_issue branch August 20, 2025 14:20
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)
Sunrisepeak added a commit that referenced this pull request May 3, 2026
Bumps VERSION 0.4.13 → 0.4.14. Highlights since 0.4.13:

  * #259 — `load_project_config_` falls through to XLINGS_PROJECT_DIR
    env after a projectScope:false skip. Fixes "no version set for
    gcc-specs-config" in installs where the cwd traversal happens to
    hit a projectScope:false `.xlings.json` (e.g. xlings's own repo
    when E2E tests run from inside `tests/e2e/runtime/...`) before
    reaching the real project root. Concrete impact: gcc.lua's
    config hook spawning the gcc-specs-config script-type shim now
    resolves the project workspace correctly via env fallback.

  * #260 — CI bumps XIM_PKGINDEX_REF to xim-pkgindex main HEAD
    (19f4383), now including:
      - #110 / #111 namespace bare-name deps
      - #116 standalone xim:gcc-runtime (~25 MB, vs full xim:gcc ~1.1 GB)
      - #117 ninja/node/mdbook switched to xim:gcc-runtime
      - #118 gcc-runtime declares correct exports.runtime.libdirs
    End-to-end E2E-05 now exercises the full predicate-driven
    elfpatch + script-as-runtime-dep flow without sidestep workarounds.

  * #261 — `xlings self uninstall` is now a real command.
    Previously the dispatcher silently fell through to help and
    exited 0, even though user-facing hints (and the
    `xlings remove xim:xlings` single-version guard) explicitly
    routed users here. Implements:
      - `xlings self uninstall` (interactive [y/N])
      - `-y` / `--yes` for automation
      - `--keep-data` to preserve `data/` for quick reinstall
      - `--dry-run` to print plan without changes
    Cross-platform self-deletion: Linux/macOS use the kernel's
    open-file-vs-dirent decoupling to unlink the running binary;
    Windows moves xlings.exe to %TEMP% and schedules delete-on-
    reboot for the temp copy (XLINGS_HOME is fully gone immediately).
    Safety invariants: refuses XLINGS_HOME=/, =$HOME, common system
    paths; refuses if `.lock` present; always prints summary even
    with `-y`. Bonus: `xlings self <unknown-action>` now exits 2
    instead of silent 0.

Migration: 0.4.13 → 0.4.14 is binary-compatible. self-update via
`xself install` / quick_install handles the upgrade.

Verified locally: 8/8 isolated-XLINGS_HOME tests pass; system
/home/speak/.xlings sha256 + pkg count untouched across runs. CI
three-platform green on PR #261.
Sunrisepeak added a commit that referenced this pull request Jun 5, 2026
….50) (#319)

* feat(0.4.50): macOS releases target 11.0 (static libc++ via mcpp 0.0.50)

macosx-arm64 releases carried minos=15.0 (runner SDK default) and
dynamically linked the system libc++, so they only ran on macOS 15.
With mcpp 0.0.50 as the build tool (static LLVM libc++ + lld + explicit
deployment target), setting MACOSX_DEPLOYMENT_TARGET=11.0 in the macos
release job produces a binary that runs on macOS 11.0+ (covers 14).
macos_release.sh now asserts minos + no-system-libc++ when the env is
set. Bump 0.4.50.

Evidence: mcpp-community/mcpp PR #115 (runs A-B5) + PR #116.
Design: .agents/docs/2026-06-05-macos-min-version-support.md
NOTE: requires XIM_PKGINDEX_REF bump to an index containing mcpp 0.0.50
(done in this branch once the index lands).

* feat: project-level macos_deployment_target + CI minos assertions

- mcpp.toml: [build] macos_deployment_target = "11.0" (mcpp 0.0.50+
  honors this natively; the env pin in CI/release remains as the second
  line of assurance and covers older bootstrap mcpp).
- ci-macos: assert the built binary's LC_BUILD_VERSION minos matches the
  pinned target; report static-vs-system libc++ (hard assertion once the
  bootstrap index ships mcpp 0.0.50).

* fix: macOS floor 11.0 -> 14.0 (official LLVM static archives' floor)

ld64.lld on mcpp CI: 'libc++.a(...o) has version 14.0.0, which is newer
than target minimum of 11.0.0' — the official LLVM-20.1.7-macOS-ARM64
static archives are built for macOS 14, so claiming an 11.0 floor would
be false. 14.0 still fully covers the original macOS 14 goal; 11-13
needs a custom libc++ build (tracked as follow-up).

* ci: bootstrap mcpp 0.0.50 (index ref bump) + hard static assertion

* ci: bootstrap mcpp 0.0.50 everywhere (.xlings.json workspace + all CI workflow pins)

The ci-macos static assertion failed because only release.yml had the
new index ref — ci workflows pin their own XIM_PKGINDEX_REF, and
.xlings.json additionally pins the mcpp workspace version (0.0.36).
All bumped to mcpp 0.0.50 / bootstrap xlings v0.4.49.

* fix: scrub injected runtime lib path in host-tool test fixtures; assert newest binary

- tests/unit Extract fixtures: mcpp 0.0.47+ exports the target
  toolchain's runtime dirs into LD_LIBRARY_PATH for test processes;
  host tar/zip/python then load the sandbox glibc and crash. Wrap
  fixture commands with SHELL=/bin/bash
COREPACK_ENABLE_AUTO_PIN=0
SESSION_MANAGER=local/speak-pc:@/tmp/.ICE-unix/5162,unix/speak-pc:/tmp/.ICE-unix/5162
QT_ACCESSIBILITY=1
NVM_RC_VERSION=
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
no_proxy=localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,172.29.0.0/16,::1
XDG_MENU_PREFIX=gnome-
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
rvm_prefix=/home/speak
AI_AGENT=claude-code_2-1-162_agent
GNOME_KEYRING_CONTROL=/run/user/1000/keyring
LANGUAGE=en_US:en
CLAUDE_CODE_SESSION_ID=1d9260d3-95e0-4bf3-9f41-e98b2468cf60
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
LC_ADDRESS=en_US.UTF-8
GNOME_SHELL_SESSION_MODE=ubuntu
LC_NAME=en_US.UTF-8
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
CLAUDE_EFFORT=high
MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
MY_RUBY_HOME=/home/speak/.rvm/rubies/ruby-3.1.0
XMODIFIERS=@im=ibus
DESKTOP_SESSION=ubuntu
LC_MONETARY=en_US.UTF-8
GTK_MODULES=gail:atk-bridge
RUBY_VERSION=ruby-3.1.0
PWD=/home/speak/workspace/github/openxlings/xlings
NIX_PROFILES=/nix/var/nix/profiles/default /home/speak/.nix-profile
XDG_SESSION_DESKTOP=ubuntu
LOGNAME=speak
XDG_SESSION_TYPE=x11
rvm_version=1.29.12 (latest)
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
SYSTEMD_EXEC_PID=5316
TMPPREFIX=/tmp/claude-1000/zsh
XAUTHORITY=/run/user/1000/gdm/Xauthority
NoDefaultCurrentDirectoryInExePath=1
CLAUDECODE=1
WINDOWPATH=2
HOME=/home/speak
USERNAME=speak
IM_CONFIG_PHASE=1
LC_PAPER=en_US.UTF-8
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=ubuntu:GNOME
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/org.gnome.SettingsDaemon.MediaKeys.service/memory.pressure
VTE_VERSION=7600
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
XLINGS_BIN=/home/speak/.xlings/subos/current/bin
TMPDIR=/tmp/claude-1000
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/fac158cf_071d_4626_9471_cfebb42239b0
XLINGS_HOME=/home/speak/.xlings
https_proxy=http://127.0.0.1:7897/
DOTNET_BUNDLE_EXTRACT_BASE_DIR=/home/speak/.cache/dotnet_bundle_extract
NVM_DIR=/home/speak/.nvm
rvm_bin_path=/home/speak/.rvm/bin
GEM_PATH=/home/speak/.rvm/gems/ruby-3.1.0:/home/speak/.rvm/gems/ruby-3.1.0@global
GEM_HOME=/home/speak/.rvm/gems/ruby-3.1.0
XDG_SESSION_CLASS=user
TERM=xterm-256color
LC_IDENTIFICATION=en_US.UTF-8
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
USER=speak
NO_PROXY=localhost,127.0.0.1,192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,172.29.0.0/16,::1
GNOME_TERMINAL_SERVICE=:1.111
CLAUDE_CODE_TMPDIR=/tmp/claude-1000
DISPLAY=:1
SHLVL=1
NVM_CD_FLAGS=
GSM_SKIP_SSH_AGENT_WORKAROUND=true
GIT_EDITOR=true
LC_TELEPHONE=en_US.UTF-8
HTTPS_PROXY=http://127.0.0.1:7897/
HTTP_PROXY=http://127.0.0.1:7897/
QT_IM_MODULE=ibus
LC_MEASUREMENT=en_US.UTF-8
PAPERSIZE=letter
http_proxy=http://127.0.0.1:7897/
XDG_RUNTIME_DIR=/run/user/1000
CLAUDE_CODE_ENTRYPOINT=cli
ALL_PROXY=socks://127.0.0.1:7897/
DEBUGINFOD_URLS=https://debuginfod.ubuntu.com
LC_TIME=en_US.UTF-8
LC_ALL=en_US.UTF-8
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
CLAUDE_CODE_EXECPATH=/home/speak/.local/share/claude/versions/2.1.162
all_proxy=socks://127.0.0.1:7897/
PATH=/home/speak/.xlings/subos/current/bin:/home/speak/.xlings/bin:/nix/var/nix/profiles/default/bin:/home/speak/.opencode/bin:/home/speak/.moon/bin:/home/speak/.rvm/gems/ruby-3.1.0/bin:/home/speak/.rvm/gems/ruby-3.1.0@global/bin:/home/speak/.rvm/rubies/ruby-3.1.0/bin:/home/speak/.local/bin:/home/speak/workspace/github/d2learn/xlings/build/xlings/data/xim/runtimedir/node-v22.12.0-linux-x64/bin:/home/speak/.cargo/bin:/home/speak/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/speak/.dotnet/tools:/home/speak/.rvm/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/claude-md-management/1.0.0/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/superpowers/5.1.0/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/code-review/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/skill-creator/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/rust-analyzer-lsp/1.0.0/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/frontend-design/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/feature-dev/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/github/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/code-simplifier/1.0.0/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/context7/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/commit-commands/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/agent-sdk-dev/unknown/bin:/home/speak/.claude/plugins/cache/claude-plugins-official/chrome-devtools-mcp/1.1.1/bin
GDMSESSION=ubuntu
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
IRBRC=/home/speak/.rvm/rubies/ruby-3.1.0/.irbrc
rvm_path=/home/speak/.rvm
LC_NUMERIC=en_US.UTF-8
OLDPWD=/home/speak/workspace/github/mcpp-community/mcpp
_=/usr/bin/env (POSIX only).
- ci-macos assertion: pick the newest xlings binary across fingerprint
  dirs (+ print all candidates for diagnosis).

* ci: fix unbalanced quotes in macos assertion echo lines

The assertion itself passed in R3 (single candidate, minos 14.0, only
libSystem in deps — static libc++ confirmed); the step failed on a
shell EOF from quote typos in the diagnostic echos.
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