GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(desktop): AppImage updates no longer leave old runtimes and mounts running by juliusmarminge · Pull Request #29672 · pingdotgg/t3code

fix(desktop): AppImage updates no longer leave old runtimes and mounts running #29672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
juliusmarminge merged 9 commits into main from fix/issue-29636
Nov 12, 2026
+140 −1
Merged

fix(desktop): AppImage updates no longer leave old runtimes and mounts running #29672

Changes from 1 commit
Commits
Show all changes
9 commits
Select commit Hold shift + click to select a range
a802473
test(desktop): reproduce #29636 AppImage relaunch inheriting descriptors
juliusmarminge Nov 2, 2026
7e91d0d
fix(desktop): AppImage updates no longer leak descriptors into the re…
juliusmarminge Nov 2, 2026
b6a2818
Merge remote-tracking branch 'origin/main' into fix/issue-29636
juliusmarminge Nov 2, 2026
1d9bd91
fix(desktop): AppImage relaunch helper ignores BASH_ENV and exported …
juliusmarminge Nov 2, 2026
791ad4a
Merge remote-tracking branch 'origin/main' into fix/issue-29636
juliusmarminge Nov 10, 2026
75c970e
test(desktop): stub APPIMAGE with vi.stubEnv in the AppImage relaunch…
juliusmarminge Nov 10, 2026
2eb5ea1
Merge remote-tracking branch 'origin/main' into fix/issue-29636
juliusmarminge Nov 11, 2026
d04e14e
Merge branch 'main' into fix/issue-29636
juliusmarminge Nov 11, 2026
2ed0138
Merge branch 'main' into fix/issue-29636
juliusmarminge Nov 12, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
test(desktop): reproduce #29636 AppImage relaunch inheriting descriptors
The relaunched AppImage inherits descriptors the updating Electron process
holds without O_CLOEXEC, so every update keeps the previous AppImage
runtime and FUSE mount alive. This test drives the real electron-updater
AppImageUpdater install through ElectronUpdater.quitAndInstall and fails
on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge @claude
juliusmarminge and claude committed Nov 2, 2026
commit a8024732534bf1e7f1ca11047fdd2b1e32d885a0

There are no files selected for viewing

125 changes: 125 additions & 0 deletions 125 apps/desktop/src/electron/ElectronUpdater.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// @effect-diagnostics nodeBuiltinImport:off -- Intercepts the spawn electron-updater requires natively.
import * as NodeServices from "@effect/platform-node/NodeServices";
import { assert, describe, it } from "@effect/vitest";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as HostProcess from "@t3tools/shared/HostProcess";
import { autoUpdater } from "electron-updater";
import type * as NodeChildProcess from "node:child_process";
import * as NodeModule from "node:module";
import { vi } from "vite-plus/test";

// electron-updater requires Electron natively, outside vi.mock's reach, and builds its
// autoUpdater singleton as soon as it is imported.
vi.hoisted(() => {
const NodeModule = process.getBuiltinModule("node:module");
const NodeEvents = process.getBuiltinModule("node:events");
const require = NodeModule.createRequire(import.meta.url);
const electronPath = NodeModule.createRequire(require.resolve("electron-updater")).resolve(
"electron",
);
const electronModule = new NodeModule.Module(electronPath);
electronModule.filename = electronPath;
electronModule.loaded = true;
electronModule.exports = {
app: {
getVersion: () => "1.0.0",
getName: () => "T3 Code",
isPackaged: true,
quit: () => undefined,
once: () => undefined,
},
autoUpdater: new NodeEvents.EventEmitter(),
};
require.cache[electronPath] = electronModule;
});

import * as ElectronUpdater from "./ElectronUpdater.ts";

const childProcess = NodeModule.createRequire(import.meta.url)("node:child_process") as {
spawn: (
command: string,
args: ReadonlyArray<string>,
options: NodeChildProcess.SpawnOptions,
) => NodeChildProcess.ChildProcess;
};

describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")(
"ElectronUpdater AppImage install",
() => {
it.live("relaunches the installed AppImage without the updating process's descriptors", () =>
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const dir = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-appimage-install-" });
const appImagePath = path.join(dir, "T3-Code.AppImage");
const stagedPath = path.join(dir, "T3-Code-1.0.1.AppImage");
const fdReportPath = path.join(dir, "relaunched-fds.txt");
yield* fileSystem.writeFileString(appImagePath, "old AppImage");
yield* fileSystem.writeFileString(
stagedPath,
`#!/bin/sh\nls /proc/self/fd > '${fdReportPath}'\n`,
);
yield* fileSystem.chmod(stagedPath, 0o755);

const previousAppImage = process.env.APPIMAGE;
yield* Effect.acquireRelease(
Effect.sync(() => {
process.env.APPIMAGE = appImagePath;
}),
() =>
Effect.sync(() => {
if (previousAppImage === undefined) delete process.env.APPIMAGE;
else process.env.APPIMAGE = previousAppImage;
}),
);

autoUpdater.logger = null;
Object.assign(autoUpdater, {
downloadedUpdateHelper: {
file: stagedPath,
downloadedFileInfo: { isAdminRightsRequired: false },
},
});

// Electron's main process holds the AppImage runtime's keepalive pipe and some
// Chromium files without O_CLOEXEC. Node cannot hold such a descriptor, so the
// relaunch runs with fd 7 opened that way to stand in for them.
const relaunched = yield* Deferred.make<void>();
const realSpawn = childProcess.spawn;
yield* Effect.acquireRelease(
Effect.sync(() => {
childProcess.spawn = (command, args, options) => {
const child = realSpawn(
"bash",
["-c", 'exec 7</dev/null; exec "$@"', "leaky-parent", command, ...args],
options,
);
child.once("exit", () => Deferred.doneUnsafe(relaunched, Effect.void));
return child;
};
NodeModule.syncBuiltinESMExports();
}),
() =>
Effect.sync(() => {
childProcess.spawn = realSpawn;
NodeModule.syncBuiltinESMExports();
}),
);

const electronUpdater = yield* ElectronUpdater.ElectronUpdater;
yield* electronUpdater.quitAndInstall({ isSilent: true, isForceRunAfter: true });
yield* Deferred.await(relaunched);

const descriptors = (yield* fileSystem.readFileString(fdReportPath)).trim().split("\n");
assert.notInclude(
descriptors,
"7",
`relaunched AppImage inherited the updating process's fd 7 (open fds: ${descriptors.join(" ")})`,
);
}).pipe(Effect.provide([ElectronUpdater.layer, NodeServices.layer])),
);
},
);
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.