mirror of
https://github.com/aaddrick/claude-desktop-debian.git
synced 2026-05-17 00:26:21 +03:00
fix(cowork.sh): allow $ in minified identifier anchors; defensive lastIndexOf (#555)
Two regex anchors in patch_cowork_linux() used \w+ to capture minified identifiers, but on Claude Desktop 1.5354.0 those identifiers contain $ (e.g. C$i, g$i). \w excludes $, so the inner captures never matched: - Patch 2b (vm: module assignment) silently no-op'd — no warning, no failure. Build log went from "Applied 12" to "Applied 10". - Patch 6 step 2 (retry-delay auto-launch) emitted a warning but still failed to apply. Either way, the resulting app.asar shipped half-patched and Cowork startup failed at runtime with "Swift VM addon not available". The fix widens both inner captures from \w+ to [\w$]+, matching the existing precedent at scripts/patches/cowork.sh:482-501 (introduced in PR #421 for the $e fs-reference rename in 1.3109.0). Also switches Patch 6 from indexOf to lastIndexOf for the "VM service not running" anchor — defensive against future versions reintroducing the string outside the retry-loop site. Verified end-to-end on Fedora 43 / KDE Plasma 6 / Wayland: build log shows "Applied 12 cowork patches"; daemon auto-launches at startup with clean lifecycle (startup → listen → SIGTERM exit code=0). Follow-ups tracked in #559. Resolves #558. Likely resolves #553 (named symptom) and #445 (daemon never auto-spawned on Linux). Co-authored-by: Joost-Maker <66303669+Joost-Maker@users.noreply.github.com> Co-authored-by: HumboldtJoker <19808525+HumboldtJoker@users.noreply.github.com> Co-authored-by: zabka <3833286+zabka@users.noreply.github.com>
This commit is contained in:
@@ -250,10 +250,14 @@ Special thanks to:
|
||||
- **[hfyeh](https://github.com/hfyeh)** for diagnosing the Ubuntu 24.04 AppArmor unprivileged-userns block on Cowork bwrap and contributing the AppArmor profile workaround
|
||||
- **[davidamacey](https://github.com/davidamacey)** for identifying and fixing the XRDP GPU compositing blank-window issue on remote desktop sessions
|
||||
- **[pb3ck](https://github.com/pb3ck)** for diagnosing the Cowork `CLAUDE_CODE_OAUTH_TOKEN` env-strip bug with a working reference diff
|
||||
- **[Joost-Maker](https://github.com/Joost-Maker)** for fixing the `$e` fs reference crash in cowork Patch 9 on Claude Desktop 1.3109.0, introducing the `[$\w]+` identifier-capture pattern at `cowork.sh:482-501` (#421)
|
||||
- **[aJV99](https://github.com/aJV99)** for exporting `GDK_BACKEND=wayland` in native Wayland mode to fix XWayland fallback blur on HiDPI displays
|
||||
- **[Andrej730](https://github.com/Andrej730)**
|
||||
- Quick-window regex readability refactor (`String.raw` + `escapeRegExp` helper)
|
||||
- Fixing the visibility-function regex break on Claude Desktop 1.3883.0 (#495)
|
||||
- Fixing the visibility-function regex break on Claude Desktop 1.3883.0 (#496)
|
||||
- **[HumboldtJoker](https://github.com/HumboldtJoker)** for diagnosing the cowork Patch 2b silent failure on Claude Desktop 1.5354.0 — identifying that the log line was patched but session init still routed through the Swift addon (#553)
|
||||
- **[zabka](https://github.com/zabka)** for identifying that `cowork-vm-service.js` was never auto-spawned on Linux and contributing a systemd-unit workaround that scoped the daemon auto-launch fix (#445)
|
||||
- **[sirfaber](https://github.com/sirfaber)** for fixing the `$`-in-minified-identifier breakage of cowork Patch 2b (vm module assignment) and Patch 6 step 2 (retry-delay auto-launch) on Claude Desktop 1.5354.0 (#555)
|
||||
|
||||
## Sponsorship
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ if (vmClientLogMatch) {
|
||||
const assignRe = new RegExp(
|
||||
'(?<!\\|\\|process\\.platform==="linux"\\)?)' +
|
||||
win32Var.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +
|
||||
'(\\s*\\?\\s*\\(?\\s*\\w+\\s*=\\s*\\{\\s*vm\\s*:\\s*\\w+\\s*\\}\\s*\\)?)'
|
||||
'(\\s*\\?\\s*\\(?\\s*[\\w$]+\\s*=\\s*\\{\\s*vm\\s*:\\s*[\\w$]+\\s*\\}\\s*\\)?)'
|
||||
);
|
||||
if (assignRe.test(code)) {
|
||||
code = code.replace(assignRe,
|
||||
@@ -261,7 +261,7 @@ if (!code.includes('"linux":{') && !code.includes("'linux':{") &&
|
||||
// silent. Falls back to "ignore" if the log dir can't be opened.
|
||||
// ============================================================
|
||||
const serviceErrorStr = 'VM service not running. The service failed to start.';
|
||||
const serviceErrorIdx = code.indexOf(serviceErrorStr);
|
||||
const serviceErrorIdx = code.lastIndexOf(serviceErrorStr);
|
||||
if (serviceErrorIdx !== -1) {
|
||||
// Step 1: Find the ENOENT check and expand it to include ECONNREFUSED
|
||||
// Pattern: VAR.code==="ENOENT"
|
||||
@@ -293,11 +293,11 @@ if (serviceErrorIdx !== -1) {
|
||||
|
||||
// Step 2: Inject auto-launch before the retry delay
|
||||
// Re-find serviceErrorStr since indices shifted after step 1
|
||||
const newServiceErrorIdx = code.indexOf(serviceErrorStr);
|
||||
const newServiceErrorIdx = code.lastIndexOf(serviceErrorStr);
|
||||
const searchEnd = Math.min(code.length, newServiceErrorIdx + 300);
|
||||
const searchRegion = code.substring(newServiceErrorIdx, searchEnd);
|
||||
const retryMatch = searchRegion.match(
|
||||
/await new Promise\((\w+)=>\s*setTimeout\(\1,\s*(\w+)\)\)/
|
||||
/await new Promise\(([\w$]+)=>\s*setTimeout\(\1,\s*([\w$]+)\)\)/
|
||||
);
|
||||
if (retryMatch) {
|
||||
const retryStr = retryMatch[0];
|
||||
|
||||
Reference in New Issue
Block a user