Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: normalize AppImage permissions and propagate repack failures

Ezra Ellette1a26df032345
diff --git a/.github/scripts/release-performance.test.ts b/.github/scripts/release-performance.test.ts
index bdc4d7555..aa134bb57 100644
--- a/.github/scripts/release-performance.test.ts
+++ b/.github/scripts/release-performance.test.ts
@@ -32,6 +32,45 @@ function fixture() {
return { root, env, write, stub, run, calls: () => readFileSync(env.CALLS, "utf8") };
}
+for (const workflow of ["release-app.yml", "release-enterprise.yml"]) {
+ for (const failure of ["none", "repack", "sign"]) {
+ test(`${workflow}: Linux repack repairs private extraction modes and propagates ${failure} failure`, () => {
+ const f = fixture();
+ const config = Bun.YAML.parse(readFileSync(join(scripts, "../workflows", workflow), "utf8")) as any;
+ const job = config.jobs[workflow === "release-app.yml" ? "publish-tauri" : "release-enterprise-linux"];
+ const step = job.steps.find((item: any) => item.name === (workflow === "release-app.yml" ? "Build (Linux)" : "Build (enterprise, Linux x64)"));
+ expect(step.run.startsWith("set -euo pipefail\n")).toBe(true);
+ const block = step.run.slice(step.run.indexOf("for APPIMAGE in "))
+ .replaceAll("${{ matrix.target }}", "x86_64-unknown-linux-gnu")
+ .replaceAll("/tmp/appimagetool", join(f.root, "bin/appimagetool"));
+ const image = f.write("src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/screenpipe.AppImage", header + `
+mkdir -p squashfs-root/usr/bin squashfs-root/usr/lib
+printf payload > squashfs-root/usr/lib/resource
+printf old-glib > squashfs-root/usr/lib/libglib-2.0.so.0
+printf launcher > squashfs-root/AppRun
+chmod 0700 squashfs-root squashfs-root/usr squashfs-root/usr/bin squashfs-root/usr/lib squashfs-root/AppRun
+chmod 0600 squashfs-root/usr/lib/resource
+`);
+ f.write("src-tauri/bun-x86_64-unknown-linux-gnu", "pristine bun");
+ const bundle = f.write(".github/scripts/linux/bundle-appimage-runtime-deps.sh", header + 'echo bundle >> "$CALLS"\n');
+ chmodSync(bundle, 0o755);
+ f.stub("appimagetool", `
+echo repack >> "$CALLS"
+python3 -c 'import pathlib,stat; root=pathlib.Path("squashfs-root"); assert all(p.stat().st_mode & 0o555 == 0o555 for p in [root,*[p for p in root.rglob("*") if p.is_dir()]]); assert (root/"AppRun").stat().st_mode & 0o555 == 0o555; assert (root/"usr/lib/resource").stat().st_mode & 0o111 == 0; assert (root/"usr/lib/resource").read_text() == "payload"; assert (root/"usr/bin/bun").read_text() == "pristine bun"; assert not (root/"usr/lib/libglib-2.0.so.0").exists()'
+${failure === "repack" ? "exit 42" : 'printf repacked > "$2"'}
+`);
+ f.stub("bunx", `echo sign >> "$CALLS"\n${failure === "sign" ? "exit 43" : 'printf signature > "$4.sig"'}\n`);
+ const result = spawnSync("bash", ["-euo", "pipefail", "-c", block], {
+ cwd: f.root, env: { ...f.env, GITHUB_WORKSPACE: f.root }, encoding: "utf8",
+ });
+ expect(result.status, result.stderr).toBe(failure === "repack" ? 42 : failure === "sign" ? 43 : 0);
+ expect(f.calls().trim().split("\n")).toEqual(failure === "repack" ? ["bundle", "repack"] : ["bundle", "repack", "sign"]);
+ expect(existsSync(`${image}.sig`)).toBe(failure === "none");
+ if (failure !== "repack") expect(readFileSync(image, "utf8")).toBe("repacked");
+ });
+ }
+}
+
test("Mac health recovery measures CPU time and never signals a replaced PID or unrelated service", () => {
const result = spawnSync("python3", ["-c", `
import importlib.util, signal, sys
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 27da4f92e..3fe2f4781 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -928,6 +928,8 @@ jobs:
CMAKE_ARGS: -DGGML_NATIVE=OFF -DGGML_AVX512=OFF -DGGML_AVX512_VBMI=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AVX512_BF16=OFF
NO_STRIP: true
run: |
+ set -euo pipefail
+
# Wrap ldd so linuxdeploy doesn't crash on the statically-linked bun sidecar.
# bun is built with musl and ldd exits 1 on it, which kills linuxdeploy's GTK plugin.
# Persistent runners may already have this wrapper from a prior job.
@@ -991,8 +993,8 @@ jobs:
# Install appimagetool for repacking
curl -fsSL -o /tmp/appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x /tmp/appimagetool
- find src-tauri/target/${{ matrix.target }}/release/bundle/appimage/ -name "*.AppImage" -exec bash -c '
- APPIMAGE="$1"
+ for APPIMAGE in src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage; do
+ [ -f "$APPIMAGE" ] || continue
echo "Patching $APPIMAGE to remove bundled GLib"
chmod +x "$APPIMAGE"
"$APPIMAGE" --appimage-extract
@@ -1008,6 +1010,7 @@ jobs:
squashfs-root/usr/lib/libavif.so*
install -m 0755 src-tauri/bun-x86_64-unknown-linux-gnu squashfs-root/usr/bin/bun
echo "Removed bundled GLib libs, repacking AppImage..."
+ chmod -R a+rX squashfs-root
ARCH=x86_64 /tmp/appimagetool squashfs-root "$APPIMAGE"
rm -rf squashfs-root
echo "AppImage repacked successfully"
@@ -1020,10 +1023,9 @@ jobs:
rm -f "$APPIMAGE.sig"
bunx tauri signer sign "$APPIMAGE"
echo "Updater signature regenerated for repacked AppImage"
- ' _ {} \;
+ done
- # find -exec does not propagate failures from the inner bash, so fail the
- # build hard if any AppImage ends up without a signature newer than itself -
+ # Require a signature newer than the final repacked AppImage;
# a stale (pre-repack) .sig bricks auto-update for every Linux user.
for f in src-tauri/target/${{ matrix.target }}/release/bundle/appimage/*.AppImage; do
[ -f "$f" ] || continue
diff --git a/.github/workflows/release-enterprise.yml b/.github/workflows/release-enterprise.yml
index 81b04b968..c8285d6df 100644
--- a/.github/workflows/release-enterprise.yml
+++ b/.github/workflows/release-enterprise.yml
@@ -758,6 +758,8 @@ jobs:
LINUXDEPLOY_OUTPUT_VERSION: "1"
APPIMAGE_EXTRACT_AND_RUN: "1"
run: |
+ set -euo pipefail
+
# Wrap ldd so linuxdeploy does not fail on the statically-linked bun sidecar.
# Persistent runners may already have this wrapper from a prior job.
# Repair the one bad state created by the old unconditional move,
@@ -796,8 +798,8 @@ jobs:
echo "Removing bundled system libraries to prevent ABI mismatch on newer distros..."
curl -fsSL -o /tmp/appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x /tmp/appimagetool
- find src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/ -name "*.AppImage" -exec bash -c '
- APPIMAGE="$1"
+ for APPIMAGE in src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage; do
+ [ -f "$APPIMAGE" ] || continue
echo "Patching $APPIMAGE to remove bundled GLib"
chmod +x "$APPIMAGE"
"$APPIMAGE" --appimage-extract
@@ -813,6 +815,7 @@ jobs:
squashfs-root/usr/lib/libavif.so*
install -m 0755 src-tauri/bun-x86_64-unknown-linux-gnu squashfs-root/usr/bin/bun
echo "Removed bundled GLib libs, repacking AppImage..."
+ chmod -R a+rX squashfs-root
ARCH=x86_64 /tmp/appimagetool squashfs-root "$APPIMAGE"
rm -rf squashfs-root
echo "AppImage repacked successfully"
@@ -820,7 +823,7 @@ jobs:
rm -f "$APPIMAGE.sig"
bunx tauri signer sign "$APPIMAGE"
echo "Updater signature regenerated for repacked AppImage"
- ' _ {} \;
+ done
for f in src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/*.AppImage; do
[ -f "$f" ] || continue