fix(deck): the launcher never counts its own AppImage runtime as the game, and Gear Lever never names it after the game (#118) #169

Merged
HumanBean merged 1 commit from omgitsgela/LongshotLauncher:fix/gear-lever-self-launcher into main 2026-11-17 20:32:04 +00:00
Contributor

Status: fix/bug · Risk: low · Needs: a Deck tester to confirm Gear Lever's rename no longer wedges the launcher's own update

What and why

Closes #118.

Gear Lever renames a shortcut's file after the app's .desktop Name (and dedupes name clashes by adding a suffix: upstream Gear Lever #428). The launcher's AppImage carried Name=Longshot in its desktop entry, so Gear Lever renamed it to longshot.appimage — and a deduped form (longshot-2.appimage) walks straight into the launcher's game-AppImage detection regex (longshot<separator>*.appimage) in Saves.RunningFrom. The launcher then saw a "running game" that was its own AppImage runtime — a different process from the launcher itself (comm like the file's name, argv[0] the file) — and refused its own update forever.

Reproduced on this machine with a built launcher AppImage copied to /tmp/glv/longshot.appimage: the AppImage runtime stays alive beside the unpacked launcher (comm=longshot.appima, argv0=/tmp/glv/longshot.appimage), while the launcher binary runs separately. The regex probe against the current Core shows longshot matching as the game's display name and separated/suffixed AppImage names reaching the AppImage arm; Running() excluded only the launcher's own pid, never its runtime process.

Measurements

No fps: a launcher self-detection fix. The checks are named under Testing.

How

  • scripts/package.sh: the AppImage's desktop entry now bakes Name=Longshot Launcher (the launcher's own Settings-menu entry, Core/Shortcuts.cs, already says that — Gear Lever now names the launcher's file after the launcher, never after the game it builds).
  • Core/Saves.cs: Running() skips the process whose argv[0] is the launcher's own AppImage — $APPIMAGE, which the AppImage runtime exports to the launcher process it started. A file name can never settle this (the launcher's longshot-2.appimage and a game's longshot-2.appimage share names); the full paths never collide. New helpers IsOwnRuntime(argv0Path, ownAppImage) and OwnAppImage(getenv); unchanged when the launcher runs unpacked (no $APPIMAGE, no runtime process).
Switch / setting Before After Why Risk if wrong
(none: no new switches; Name= in the packaged desktop entry) Name=Longshot Name=Longshot Launcher the shortcut manager names the launcher after itself, not the game a menu showing "Longshot Launcher" instead of "Longshot" beside the same icon; nothing reads the name for behavior

Testing

  • python -I tests/test_launcher_core.py --dotnet <dotnet> on this branch: launcher core: 1465 checks passed, including new pins: IsOwnRuntime exact-path identity; the near-miss (same file name, different folder) is NOT the launcher's own; empty/missing envs; the normal never-renamed launcher AppImage is its own runtime too; two source pins — package.sh's desktop entry must say Name=Longshot Launcher, and Running() must consult IsOwnRuntime(argv0, ownImage) (pid-only self-exclusion is what missed the runtime).
  • Mutation probe: removing the Running() exclusion line fails its source pin and re-greens on restore.
  • Repro evidence (the mechanism, not a bundled artifact): an AppImage copied and run as longshot.appimage shows the runtime process (comm=longshot.appima, argv0 the file) beside the launcher binary; the RunningFrom probe names what matches and what doesn't on current main.

Not tested: Gear Lever itself renaming a packaged AppImage on a Deck (the rename is Gear Lever's behavior, reported in #118 with the screenshot; our fix removes both halves of what made that rename harmful). A Deck tester should update through Gear Lever once and confirm the launcher updates normally. Windows unaffected (the AppImage arm is Linux-only).

When it applies

  • The change is game-free and testable without a game (launcher core checks).
  • Source-reading checks were updated with the code (the two pins above).

Rollback

Reverting this commit restores Name=Longshot and pid-only exclusion; users whose files Gear Lever already renamed keep those file names and go back to refusing their own update while the runtime runs.

Privacy

Nothing user-supplied is added to logs, telemetry, or reports; the only new read is the launcher's own $APPIMAGE env and /proc/<pid>/cmdline it already read.

**Status:** fix/bug · **Risk:** low · **Needs:** a Deck tester to confirm Gear Lever's rename no longer wedges the launcher's own update ## What and why Closes #118. Gear Lever renames a shortcut's file after the app's `.desktop` `Name` (and dedupes name clashes by adding a suffix: upstream Gear Lever #428). The launcher's AppImage carried `Name=Longshot` in its desktop entry, so Gear Lever renamed it to `longshot.appimage` — and a deduped form (`longshot-2.appimage`) walks straight into the launcher's game-AppImage detection regex (`longshot<separator>*.appimage`) in `Saves.RunningFrom`. The launcher then saw a "running game" that was its own AppImage runtime — a different process from the launcher itself (comm like the file's name, argv[0] the file) — and refused its own update forever. Reproduced on this machine with a built launcher AppImage copied to `/tmp/glv/longshot.appimage`: the AppImage runtime stays alive beside the unpacked launcher (`comm=longshot.appima`, `argv0=/tmp/glv/longshot.appimage`), while the launcher binary runs separately. The regex probe against the current `Core` shows `longshot` matching as the game's display name and separated/suffixed AppImage names reaching the AppImage arm; `Running()` excluded only the launcher's own pid, never its runtime process. ## Measurements No fps: a launcher self-detection fix. The checks are named under Testing. ## How - `scripts/package.sh`: the AppImage's desktop entry now bakes `Name=Longshot Launcher` (the launcher's own Settings-menu entry, `Core/Shortcuts.cs`, already says that — Gear Lever now names the launcher's file after the launcher, never after the game it builds). - `Core/Saves.cs`: `Running()` skips the process whose argv[0] **is** the launcher's own AppImage — `$APPIMAGE`, which the AppImage runtime exports to the launcher process it started. A file name can never settle this (the launcher's `longshot-2.appimage` and a game's `longshot-2.appimage` share names); the full paths never collide. New helpers `IsOwnRuntime(argv0Path, ownAppImage)` and `OwnAppImage(getenv)`; unchanged when the launcher runs unpacked (no `$APPIMAGE`, no runtime process). | Switch / setting | Before | After | Why | Risk if wrong | |---|---|---|---|---| | (none: no new switches; `Name=` in the packaged desktop entry) | `Name=Longshot` | `Name=Longshot Launcher` | the shortcut manager names the launcher after itself, not the game | a menu showing "Longshot Launcher" instead of "Longshot" beside the same icon; nothing reads the name for behavior | ## Testing - `python -I tests/test_launcher_core.py --dotnet <dotnet>` on this branch: `launcher core: 1465 checks passed`, including new pins: `IsOwnRuntime` exact-path identity; the near-miss (same file name, different folder) is NOT the launcher's own; empty/missing envs; the normal never-renamed launcher AppImage is its own runtime too; two source pins — `package.sh`'s desktop entry must say `Name=Longshot Launcher`, and `Running()` must consult `IsOwnRuntime(argv0, ownImage)` (pid-only self-exclusion is what missed the runtime). - Mutation probe: removing the `Running()` exclusion line fails its source pin and re-greens on restore. - Repro evidence (the mechanism, not a bundled artifact): an AppImage copied and run as `longshot.appimage` shows the runtime process (`comm=longshot.appima`, argv0 the file) beside the launcher binary; the `RunningFrom` probe names what matches and what doesn't on current main. **Not tested:** Gear Lever itself renaming a packaged AppImage on a Deck (the rename is Gear Lever's behavior, reported in #118 with the screenshot; our fix removes both halves of what made that rename harmful). A Deck tester should update through Gear Lever once and confirm the launcher updates normally. Windows unaffected (the AppImage arm is Linux-only). ## When it applies - [x] The change is game-free and testable without a game (launcher core checks). - [x] Source-reading checks were updated with the code (the two pins above). ## Rollback Reverting this commit restores `Name=Longshot` and pid-only exclusion; users whose files Gear Lever already renamed keep those file names and go back to refusing their own update while the runtime runs. ## Privacy Nothing user-supplied is added to logs, telemetry, or reports; the only new read is the launcher's own `$APPIMAGE` env and `/proc/<pid>/cmdline` it already read.
fix(deck): the launcher never counts its own AppImage runtime as the game, and Gear Lever never names it after the game (#118)
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
836eb5d954
Gear Lever renames shortcuts' files after the .desktop Name, and dedupes clashes with a suffix:
the launcher's AppImage became longshot.appimage / longshot-2.appimage, and a deduped name walks
into the game-AppImage regex (longshot<separator>*.appimage) in RunningFrom — the launcher read
its own AppImage runtime process (a different pid: comm like the file name, argv[0] the file) as
a running game and refused its own update forever. Reproduced on this machine: the runtime stays
alive beside the unpacked launcher (comm longshot.appima, argv0 /tmp/glv/longshot.appimage).

Two fixes, both pinned by tests:
- package.sh bakes Name=Longshot Launcher into the AppImage's desktop entry (the launcher's own
  Settings menu entry, Core/Shortcuts.cs, already says that — Gear Lever now names the launcher
  after itself, never after the game it builds).
- Running() skips the process whose argv[0] IS the launcher's own AppImage ($APPIMAGE as the
  AppImage runtime exports it to the launcher): the pid-only self-exclusion could never cover the
  runtime, and a file name can never tell the launcher's longshot-2.appimage from a game's — the
  full paths decide. IsOwnRuntime/OwnAppImage are the tested helpers; a source pin keeps Running()
  itself calling it.

Tests: launcher core 1465 checks (new: path identity, near-miss same-name-different-path, no-env
cases, the normal AppImage; source pins for both fixes). Mutation: removing the Running()
exclusion fails its source pin.
Author
Contributor

Tested in game: no

Tested in game: no
First-time contributor

Nice fix, one catch with the path match: the AppImage runtime sets APPIMAGE from readlink("/proc/self/exe") (type2-runtime's runtime.c), so it's the resolved real path, while argv[0] is whatever path was typed. Path.GetFullPath doesn't resolve symlinks, so they won't match when the launcher is started through one. On Bazzite/Silverblue /home is a symlink to /var/home, so /home/user/AppImages/longshot.appimage_0.appimage vs APPIMAGE=/var/home/user/... keeps the bug. A relative ./x.appimage can miss too if the cwd differs.

Comparing /proc/<pid>/exe with APPIMAGE instead should always match: the runtime process's exe is the AppImage file itself, resolved by the kernel the same way APPIMAGE was. Maybe keep the argv[0] check as a fallback for TARGET_APPIMAGE (AppImageLauncher's bypass). A test with a symlinked path would cover it.

For context, a Bazzite user on Discord hit #118 today: Gear Lever renamed the launcher to longshot.appimage_0.appimage, which matches the running-game regex.

Nice fix, one catch with the path match: the AppImage runtime sets `APPIMAGE` from `readlink("/proc/self/exe")` (type2-runtime's `runtime.c`), so it's the resolved real path, while `argv[0]` is whatever path was typed. `Path.GetFullPath` doesn't resolve symlinks, so they won't match when the launcher is started through one. On Bazzite/Silverblue `/home` is a symlink to `/var/home`, so `/home/user/AppImages/longshot.appimage_0.appimage` vs `APPIMAGE=/var/home/user/...` keeps the bug. A relative `./x.appimage` can miss too if the cwd differs. Comparing `/proc/<pid>/exe` with `APPIMAGE` instead should always match: the runtime process's exe is the AppImage file itself, resolved by the kernel the same way `APPIMAGE` was. Maybe keep the argv[0] check as a fallback for `TARGET_APPIMAGE` (AppImageLauncher's bypass). A test with a symlinked path would cover it. For context, a Bazzite user on Discord hit #118 today: Gear Lever renamed the launcher to `longshot.appimage_0.appimage`, which matches the running-game regex.
HumanBean deleted branch fix/gear-lever-self-launcher 2026-11-17 20:32:05 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!169
No description provided.