Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Desktop: keep the bundled AppImage tray loader off the host's Ayatana (#16613)

Debojyoti Banerjee0d9d7a5af42c
diff --git a/studio/src-tauri/linux/finalize-complete-appimage.sh b/studio/src-tauri/linux/finalize-complete-appimage.sh
index 916f41a62b5..719ac8a5929 100755
--- a/studio/src-tauri/linux/finalize-complete-appimage.sh
+++ b/studio/src-tauri/linux/finalize-complete-appimage.sh
@@ -74,6 +74,15 @@ done < <(find "$appdir" -path "$appdir/usr/bin/host" -prune -o -type f -print0)
((patched > 0)) || { echo "AppDir contains no dynamic ELF objects" >&2; exit 1; }
+# libappindicator-sys dlopens libayatana-appindicator3.so.1 before libappindicator3.so.1, and the
+# bundle ships only the latter. The first name would miss the RUNPATH and load the host's Ayatana
+# against the bundled GLib (#16605), so alias it to the bundled library. A real bundled Ayatana wins.
+tray_library="$libdir/libappindicator3.so.1"
+tray_alias="$libdir/libayatana-appindicator3.so.1"
+if [[ -f "$tray_library" ]] && { [[ -L "$tray_alias" ]] || [[ ! -e "$tray_alias" ]]; }; then
+ ln -sfn "libappindicator3.so.1" "$tray_alias"
+fi
+
# AppRun runs this copy when the host has a complete WebKitGTK >= 2.54 stack.
[[ ! -e "$appdir/usr/bin/lib" ]] || {
echo "AppDir has usr/bin/lib, which the host-mode executable's RUNPATH reaches" >&2
diff --git a/studio/src-tauri/linux/verify-complete-appimage.sh b/studio/src-tauri/linux/verify-complete-appimage.sh
index 1e3e8b845f5..e446a4c92ae 100755
--- a/studio/src-tauri/linux/verify-complete-appimage.sh
+++ b/studio/src-tauri/linux/verify-complete-appimage.sh
@@ -62,6 +62,12 @@ if ((${#missing_components[@]} > 0)); then
exit 1
fi
+# The tray loader tries the Ayatana name first; without a bundled one it loads the host's (#16605).
+if [[ -e "$appdir/usr/lib/libappindicator3.so.1" && ! -e "$appdir/usr/lib/libayatana-appindicator3.so.1" ]]; then
+ echo "Complete AppImage has no bundled libayatana-appindicator3.so.1, so its tray loader reaches the host's Ayatana" >&2
+ exit 1
+fi
+
launchers=("$appdir/AppRun")
[[ ! -e "$appdir/AppRun.wrapped" ]] || launchers+=("$appdir/AppRun.wrapped")
if grep -aEq '^[[:space:]]*(export[[:space:]]+)?LD_LIBRARY_PATH=' "${launchers[@]}" \
diff --git a/tests/security/test_release_desktop_appimage.py b/tests/security/test_release_desktop_appimage.py
index 67bcae15f54..9c2eef27556 100644
--- a/tests/security/test_release_desktop_appimage.py
+++ b/tests/security/test_release_desktop_appimage.py
@@ -337,6 +337,7 @@ def _fake_complete_appdir(tmp_path: Path) -> Path:
"libwebkit2gtkinjectedbundle.so",
):
(runtime / name).touch()
+ (runtime / "libayatana-appindicator3.so.1").symlink_to("libappindicator3.so.1")
gio_modules = runtime / "gio/modules"
gio_modules.mkdir(parents = True)
@@ -443,6 +444,30 @@ def test_complete_appimage_verifier_requires_the_bundled_media_pipeline(tmp_path
assert "gst-plugin-scanner" in result.stderr
+def test_complete_appimage_verifier_keeps_the_tray_loader_off_the_host_ayatana(tmp_path):
+ # libappindicator-sys tries the Ayatana name first, so a bundle without it loads the host's.
+ unaliased = _fake_complete_appdir(tmp_path / "unaliased")
+ (unaliased / "usr/lib/libayatana-appindicator3.so.1").unlink()
+ result = _verify(unaliased)
+ assert result.returncode != 0
+ assert "libayatana-appindicator3.so.1" in result.stderr
+
+ dangling = _fake_complete_appdir(tmp_path / "dangling")
+ alias = dangling / "usr/lib/libayatana-appindicator3.so.1"
+ alias.unlink()
+ alias.symlink_to("missing.so.1")
+ result = _verify(dangling)
+ assert result.returncode != 0
+ assert "libayatana-appindicator3.so.1" in result.stderr
+
+ real = _fake_complete_appdir(tmp_path / "real")
+ alias = real / "usr/lib/libayatana-appindicator3.so.1"
+ alias.unlink()
+ alias.touch()
+ result = _verify(real)
+ assert result.returncode == 0, result.stderr
+
+
def test_complete_appimage_verifier_rejects_global_library_path_and_missing_origin_runpath(
tmp_path,
):
@@ -1294,6 +1319,43 @@ def test_finalizer_adds_an_identical_host_copy_and_stays_idempotent(tmp_path):
assert "usr/bin/lib" in result.stderr
[email protected](shutil.which("patchelf") is None, reason = "the finalizer needs patchelf")
+def test_finalizer_aliases_the_ayatana_name_to_the_bundled_tray_library(tmp_path):
+ finalizer = _finalizer_tools(tmp_path)
+
+ def appdir_with(name: str) -> Path:
+ appdir = tmp_path / name
+ binary = appdir / "usr/bin/unsloth-studio"
+ binary.parent.mkdir(parents = True)
+ _compile_fixture_elf(binary, origin_runpath = False)
+ (appdir / "usr/lib").mkdir()
+ return appdir
+
+ bundled = appdir_with("bundled")
+ (bundled / "usr/lib/libappindicator3.so.1").write_bytes(b"legacy appindicator")
+ alias = bundled / "usr/lib/libayatana-appindicator3.so.1"
+ # linuxdeploy runs the finalizer once from each of the gtk and gstreamer plugins.
+ for _ in range(2):
+ subprocess.run([finalizer, bundled], check = True, capture_output = True, text = True)
+ assert alias.is_symlink()
+ assert os.readlink(alias) == "libappindicator3.so.1"
+ assert alias.read_bytes() == b"legacy appindicator"
+ # Host mode's $ORIGIN/../lib reaches no bundled library, so it still loads the host's tray.
+ assert not (bundled / "usr/bin/lib").exists()
+
+ ayatana = appdir_with("ayatana")
+ (ayatana / "usr/lib/libappindicator3.so.1").write_bytes(b"legacy appindicator")
+ (ayatana / "usr/lib/libayatana-appindicator3.so.1").write_bytes(b"real ayatana")
+ subprocess.run([finalizer, ayatana], check = True, capture_output = True, text = True)
+ real = ayatana / "usr/lib/libayatana-appindicator3.so.1"
+ assert not real.is_symlink()
+ assert real.read_bytes() == b"real ayatana"
+
+ no_tray = appdir_with("no-tray")
+ subprocess.run([finalizer, no_tray], check = True, capture_output = True, text = True)
+ assert not os.path.lexists(no_tray / "usr/lib/libayatana-appindicator3.so.1")
+
+
def test_apprun_never_probes_without_a_timeout(tmp_path):
tools = tmp_path / "bin"
tools.mkdir()