fix(desktop): Electron and Chromium apps start however they are launched (#3106)

* fix(desktop): Electron and Chromium apps start however they are launched

The session preload only added --no-sandbox when the program path itself
sat beside chrome-sandbox, so a PATH link such as /usr/bin/vesktop was
missed and the app aborted on the setuid sandbox. It now resolves the
path and also checks the parent folder, and adds --ozone-platform=x11
when an X display is set, since Wayland cannot open the GPU stand-in.

The desktop menu overrides that added the same flags are removed: they
covered only menu launches made after the desktop started, and the
preload now covers every launch. Stale overrides are cleaned up by the
existing marker check.

* fix(preload): execvp checks the program found on PATH for the Chromium flags

* fix(preload): the PATH lookup prefers the program execvp would run
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-23 21:23:56 -05:00
1 parent 366afa6b73
commit d967dd03a3
7 files changed
+144 -132

No files matched your search

+18
View File
@@ -209,6 +209,24 @@ class BinfmtPreloadTest(unittest.TestCase):
code = self.chromium_script()
self.assertEqual(self.run_program("execve", code, "--version"), (0, "--no-sandbox\n--version", None))
def test_a_chromium_app_named_on_path_receives_no_sandbox(self):
(self.dir / "code").symlink_to(self.chromium_script())
for how in ("execvp", "execvpe", "spawnp"):
out = self.run_program(how, "code", "--version")
self.assertEqual(out[1].splitlines()[:2], ["--no-sandbox", "--version"], how)
def test_a_path_match_that_cannot_run_does_not_decide_the_flags(self):
stale = self.dir / "stale"
stale.mkdir()
(stale / "util").write_text("#!/bin/sh\n")
(stale / "chrome-sandbox").touch()
util = self.dir / "util"
util.write_text("#!/bin/sh\nprintf '%s\\n' \"$@\"\n")
util.chmod(0o755)
for how in ("execvp", "execvpe", "spawnp"):
out = self.run_program(how, "util", "--version", PATH=f"{stale}:{self.dir}:/usr/bin:/bin")
self.assertEqual(out[1].splitlines()[:1], ["--version"], how)
def test_the_hand_off_switch_works_without_the_desktop(self):
tool = self.x86()
for how in ("execve", "execvp"):