Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Control launcher: shell built-ins only (no dirname)

Niko122114691f6e53b5
diff --git a/apps/desktop/scripts/stage-control.py b/apps/desktop/scripts/stage-control.py
index 661d9148c..b207a6584 100644
--- a/apps/desktop/scripts/stage-control.py
+++ b/apps/desktop/scripts/stage-control.py
@@ -86,9 +86,13 @@ def add_installer(folder: Path) -> dict:
#: What the other names of the interpreter become: Tauri copies a symlink as a full copy of its target, so `python`, `python3` and
#: `python3.12` in a bundle would be three real files (68 MB each on Linux). Only `python3.12` stays the real one.
+#: The launcher runs inside the AppImage's environment (LD_LIBRARY_PATH holds the bundled libraries), where an external program such as
+#: `dirname` can fail to start (Ubuntu 26.04's coreutils: "libsystemd.so.0: version LIBSYSTEMD_254 not found"), so it uses shell built-ins
+#: only. The first version called `dirname`; that left the folder empty and "Control stopped" on such a computer.
LAUNCHER = """#!/bin/sh
-# Strata: this name only starts the real interpreter beside it (the bundle keeps one copy, not one per name).
-here=$(cd "$(dirname "$0")" && pwd)
+# Strata: this name only starts the real interpreter beside it (the bundle keeps one copy, not one per name). Built-ins only: no dirname.
+case "$0" in */*) dir=${0%%/*} ;; *) dir=. ;; esac
+here=$(cd "$dir" && pwd)
exec "$here/%s" "$@"
"""
diff --git a/tests/desktop/test_control_install.py b/tests/desktop/test_control_install.py
index 15c1bbba6..b36df1b3f 100644
--- a/tests/desktop/test_control_install.py
+++ b/tests/desktop/test_control_install.py
@@ -139,6 +139,11 @@ class ControlModeTests(unittest.TestCase):
out = subprocess.run([str(bindir / "python"), "a b", "c"], capture_output=True, text=True).stdout
self.assertEqual(out.strip(), "real a b c")
self.assertEqual(stage.dedupe_python(folder), [], "run twice: nothing left to change")
+ # no external program: with an empty PATH (and, in the AppImage, libraries that make `dirname` fail) the launcher still starts the
+ # interpreter, from another folder and through a relative name. Ubuntu 26.04: "dirname: libsystemd.so.0: version LIBSYSTEMD_254 not found".
+ for cwd, name in ((str(folder), "python/bin/python3"), (str(bindir), "./python"), (str(bindir.parent), "bin/python")):
+ r = subprocess.run(["/bin/sh", name, "x"], capture_output=True, text=True, cwd=cwd, env={"PATH": ""})
+ self.assertEqual(r.stdout.strip(), "real x", (cwd, name, r.stderr))
def test_the_bundle_lists_everything_the_install_imports(self):
sys.path.insert(0, str(ROOT / "apps" / "desktop" / "scripts"))