fix(launcher): parse Exec the way the desktop does, single quotes included - #89
Merged
Conversation
…luded Two releases of tron-pwa reported "no TronBrowser web apps" on a machine with eleven of them. They were in the directory it scans, under names it now matches, carrying the --app-id and --user-data-dir it looks for. It could not read them. Flatpak's flextop exports every argument single-quoted: Exec=flatpak 'run' '--command=/app/bin/chromium' '--app-id=abc…' The desktop-entry spec defines only double quotes, and the parser followed the spec -- so `'--app-id=abc…'` came out as one literal token with an apostrophe on the front, every startswith() test failed, and the file was classified as not a web app and skipped whole. GLib's g_shell_parse_argv, which is what actually launches these entries, honours single quotes; being stricter than the launcher meant not seeing files that work fine for everyone else. Parse like GLib: backslash escapes outside quotes, single quotes literal, double quotes as before. That also makes the launch failure legible. The flextop command carries --user-data-dir=~/.tronbrowser but no --filesystem grant, so the sandbox cannot read the profile directory: Chromium starts, cannot open the profile, and exits a few seconds later. The launcher passes --filesystem="$DATA", which is why the same app opens from the address bar and dies from its icon -- and why routing the shortcut through the launcher is the fix rather than a tidy-up. Verified against the reported file byte-for-byte: found, rewritten to run the launcher with the app id and profile intact and the flatpak wrapper dropped, and reverted back to the original exactly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZXtxiVkXd7rFmvrMYV7Ut
ThreatCrush Security Scan49 finding(s) MEDIUM: 31 | LOW: 18
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two releases of
tron-pwareported "no TronBrowser web apps" on a machine witheleven of them. They were in the directory it scans, under names #88 taught it
to match, carrying the
--app-idand--user-data-dirit looks for. It couldnot read them.
The bug
Flatpak's flextop exports every argument single-quoted:
The desktop-entry spec defines only double quotes, and the parser followed the
spec. So
'--app-id=fpmog…'came out as a single literal token with anapostrophe on the front, every
startswith("--app-id=")test failed, and thefile was classified as not a web app and skipped whole.
GLib's
g_shell_parse_argv— which is what actually launches these entries —honours single quotes. Being stricter than the launcher meant not seeing files
that work perfectly well for everyone else. The parser now follows GLib:
backslash escapes outside quotes, single quotes literal with no escapes, double
quotes as before.
What was actually killing the app
Worth recording, because it explains why routing through the launcher is the fix
and not just tidiness. That flextop command carries
--user-data-dir=~/.tronbrowserbut no--filesystem=grant, so the sandboxcannot read the profile directory. Chromium starts, fails to open the profile,
and exits a few seconds later — which is what the icon looked like from outside.
The launcher runs
flatpak run --filesystem="$DATA" --filesystem="$EXTBASE_SRC" ….That is the difference between the address bar (works) and the icon (dies).
Verification
Tested against the reported file byte-for-byte: found, rewritten to run the
launcher with app id and profile intact and the
flatpak run --command=…wrapper dropped, and reverted back to the original exactly.
4 new cases including that verbatim file; 24 in the file, 113 in the desktop
suite. Typecheck and lint clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SZXtxiVkXd7rFmvrMYV7Ut