Skip to content

Carry the GSTheme live-switch fix in the Windows libs-gui layer - #88

Merged
danjboyd merged 14 commits into
masterfrom
carry-gui-theme-live-switch
Nov 18, 2026
Merged

danjboyd merged 14 commits into
masterfrom
carry-gui-theme-live-switch

Conversation

@danjboyd

Copy link
Copy Markdown
Owner

Follow-up to #86. Draft: this is not yet in v0.1.9 scope; Dan's v0.1.9 staging ask gets a separate include/skip choice with this PR's evidence.

The crash: on stock libs-gui 0.32, an app that switches live between two themes overriding the same method overflows the stack. WinUITheme ↔ Gumdrop crashes with 0xC00000FD in 4 of 5 cases, found by WinUITheme 2026-11-18.

The fix: apt_portstree libs-gui 0012 (5477c5230), the 0.32 port of libs-gui master 8c285f3; gnustep's backport e6fd411ab gives identical files. It is carried here as libs-gui/msys2-0.32.0/0004.

  • It touches only Source/GSTheme.m, plus its regression test.
  • It applies cleanly after our 0001–0003.

Changes:

  • the patch, its carry.json entry, and an inventory row;
  • toolchains/carry/windows/check-theme-live-switch.sh, which runs the patch's Tests/gui/GSTheme/liveSwitch.m against a root;
  • a new layer workflow step: the test must pass on the patched root and detect the loop on the stock root.

Evidence to come: one dispatch of Windows Patch Layer on this branch, after #86 merges. That run covers the layer build, the ABI check, smoke, the live switch in both directions, and the variant round trip.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ

danjboyd and others added 14 commits November 17, 2026 22:15
…er design

- docs/carried-patches/inventory.md: every GNUstep patch our toolchain and
  ScreenshotTool, ObjcMarkdown and LinDirStat carry, with bases, upstream
  state and the drift between the apps' copies.
- docs/carried-patches/README.md: how apps submit, update and retire
  carried patches (draft for Dan's review).
- docs/specs/patch-layer.md: option B, a stock toolchain plus an optional
  signed patch layer the user chooses (draft for Dan's review).

Docs only; no code or artifact changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
- toolchains/carry/carry.json and the 17 Windows patches:
  - libs-back: danjboyd/libs-back carry-0.32.0.6's 13 code commits;
  - libs-gui: upstream 3f5efad1 plus ObjcMarkdown's layout and theme patches;
  - libs-base: ObjcMarkdown's attributed-string hash patch, on top of our
    stock recipe's patches.
  Each applies cleanly to the stock release sources.
- MSYS2-style recipes for gnustep-gui and gnustep-back that take the patches
  from CARRY_PATCH_DIR; the stock gnustep-base recipe applies them only when
  CARRY_PATCH_DIR is set, so the stock package is unchanged.
- src/gnustep_cli_shared/carry_layer.py: checks carry.json, keeps only each
  base's declared outputs that differ from a stock toolchain zip, refuses any
  removed export (ABI), and writes the layer zip with carry-layer.json.
  11 unit tests.
- windows-carry-layer.yml: builds the three packages in the locked MSYS2 root,
  builds the layer against a given stock toolchain zip, then smoke-tests the
  stock root with the layer applied (smoke-toolchain.sh plus an AppKit start
  on the win32 backend). Nothing is published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…ring the patch layer

- applyCarryLayerArtifact:
  1. fetches the release's carry-layer artifact (next to the manifest, or
     downloaded) and checks its sha256;
  2. requires the installed toolchain to be the one the layer was built for,
     and every file to be exactly the stock one, before anything moves;
  3. moves each stock file to state/carry/stock (a rename, which works for a
     DLL in use on Windows), copies the patched one in and verifies it;
  4. undoes everything on any failure.
  It records carry-layer.json at the root and toolchain_variant/carry_layer
  in the state.
- restoreStockToolchainForInstallRoot: puts the stock files back and checks
  them against stock_sha256.
- setup:
  - --variant on an existing install switches it without reinstalling;
  - on a new install it installs stock, then applies the layer;
  - --upgrade (what update runs) re-applies the layer when the install was
    patched, or keeps the new stock toolchain with a warning when the release
    has no layer.
- 4 native tests: round trip, refusals (changed stock file, other
  toolchain), a failed install putting stock back, option checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…e installed CLI

Both bootstraps install stock as before. With --variant patched they then run
the installed CLI's 'setup --variant patched' (so the layer's checks live in
one place) and fold its JSON into theirs as carry_layer, keeping --json a
single document. A failure reports that the stock install is in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…d toolchain

stage-release takes --carry-input target=<layer zip> (the multi-run path
finds gnustep-carry-<target>-<version>.zip like the cli and toolchain inputs).
Before staging, every replaced file's stock_sha256 is checked against the
staged toolchain archive, along with the layer's recorded toolchain sha256.
The layer becomes artifact carry-layer-<target> (kind carry-layer,
requires_toolchain, optional). verify-release repeats the check. 2 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…tly applied layer

Both doctors read carry-layer.json and check each listed file against its
patched and stock sha256. Stock: ok. Patched and intact: ok, with the patch
ids. A mix, or a patched state without its record: an error that names the
repair (setup --variant stock, then patched). Full CLI only; the bootstrap
doctor lists it as not_run. 3 Python tests; native coverage added to the
round-trip test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…ap hand-off, doctor id)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…run 44238854552)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…tched round trip, update keeps the variant

A second job in windows-carry-layer.yml:
1. builds the CLI from the branch;
2. stages releases 0.1.9 and 0.1.10 with the real stage_release_assets
   (so the toolchain check on the layer runs too);
3. signs them with a throwaway key;
4. under Windows PowerShell 5.1, installs with the bootstrap's --variant
   patched, switches to stock and back with the root's own gnustep.exe
   (whose gnustep-base DLL is the patched one), checks the clang64 tree is
   byte-identical after a round trip, and updates to 0.1.10, checking
   files, state and doctor at every step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
Run 44241435699 passed every product step but reported ok=False: the
bootstrap's --allow-unsigned warning, merged in by *>, came before its JSON.
The bootstrap's stderr now goes to its own file, and Read-Json starts at the
first line beginning with '{'. Artifact downloads retry, after a dropped
connection failed the first attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…tocol

# Conflicts:
#	src/full-cli/Tests/GSCommandWorkflowTests.m
…tocol

# Conflicts:
#	src/gnustep_cli_shared/doctor_engine.py
Stock libs-gui 0.32 overflows the stack when an app switches live between
two themes that override the same method (WinUITheme <-> Gumdrop crashes
0xC00000FD in 4 of 5 cases). Carry apt_portstree's libs-gui 0012
(5477c5230, the 0.32 port of libs-gui master 8c285f3) as
libs-gui/msys2-0.32.0/0004, and run its regression test liveSwitch.m in
the layer workflow: it must pass on the patched root and detect the loop
on the stock root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugm29zKJUHxvomQeDSzshZ
…e-switch

# Conflicts:
#	.github/workflows/windows-carry-layer.yml
#	docs/carried-patches/inventory.md
#	toolchains/carry/carry.json
@danjboyd

Copy link
Copy Markdown
Owner Author

Windows Patch Layer run 44368779273 (dispatch on ebb9413, stock base run 44189762879): success.

Layer: gnustep-carry-windows-amd64-msys2-clang64-0.1.9-dev.zip, sha256 c91aabc9…. It holds the same 4 files as #86's layer, built from 18 patches.

ABI check: nothing removed. Added, compared with #86's layer:

Smoke: the toolchain smoke passed, and the AppKit program reports WIN32Server.

GSTheme live switch (liveSwitch.m from the patch):

root passed failed
patched 14 0
stock 4 10

The stock failures start at "after switching A to B, B chains to the original, not to A". The switch back is checked too, and so are a second switch, default-theme removal and inherited-method overrides.

Variant gate (Windows PowerShell 5.1), ok=True:

  • the bootstrap installs the patched variant;
  • stock → patched → stock leaves the stock tree byte-identical;
  • an update to 0.1.10 keeps the patched variant;
  • doctor reports ok each time.

@danjboyd
danjboyd marked this pull request as ready for review November 18, 2026 19:09
@danjboyd
danjboyd merged commit 314248b into master Nov 18, 2026
5 checks passed
@danjboyd
danjboyd deleted the carry-gui-theme-live-switch branch November 18, 2026 22:23
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