Repository navigation
Conversation
…es, and empty names Posted by Kevin's agent on his behalf — AI-assisted (Muse, Meta's Muse Spark). Rebased onto current quattro (was 28ceaae).
…wline in Exec Posted by Kevin's agent on his behalf — AI-assisted (Muse, Meta's Muse Spark). Addresses QA HOLD on PR #85: the newline case inspected `ls *.desktop | head -1` while $apps held entries from earlier cases, so it could pass on an unrelated clean file. The case now clears $apps and asserts on the exact slug-derived entry. That exposed a real bug: desktop_exec_quote did not escape newlines, so a newline in the ROM path injected a second Exec= key line. Newlines (and CR/tab) are now escaped in Exec args.
[Medium impact] The PR appears safe to merge; the latest test change introduces no identified defect. SummaryThe PR escapes ROM names and paths in generated desktop entries, canonicalizes ROM paths, and adds launcher tests. The latest change strengthens the relative-path test by checking that reinstalling uses the same launcher ID. Reviews (5) · Last reviewed commit: "test(games): require relative install to..." · Reviewed by Greptile |
|
This is a real Desktop Entry injection / Exec-breakage fix, not just polish.
Nit: fallback |
…allback id on the ROM path Exec is a string value first and an argument list second, so a quoted argument needs both layers: the Exec-spec quoting for the argument, then the string escaping for the line. With one layer, a quote in a ROM path wrote \" into the file, an escape GLib's key file parser rejects, so gtk-launch refused the whole entry and the game vanished from the launcher. This now composes the two layers the way omarchy-webapp-install does, and escapes ` and $ inside the quotes as the spec asks. The fallback id for a name that slugs to nothing was a fixed retro-game, so a second such ROM (any title with no ASCII letters or digits, a Japanese one say) overwrote the first's launcher. It now carries a short hash of the ROM path, which stays stable across reinstalls of the same game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roarch's argv The escaping checks compared text in the generated file, which passed while a quote in a ROM path made an entry GLib refused to load. This launches each adversarial entry with gio launch, the same GDesktopAppInfo path gtk-launch takes, against a stub retroarch that records its arguments, and requires the exact ROM path back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Thanks @kvnloo. The bug is real: on a worker running stock Omarchy, I generated launchers with Your branch fixed most of that, but two things were still wrong, and I've pushed two commits on top:
At 6859dae, every case reaches RetroArch with the exact path through both launchers: quotes, Codex Medium reviewed it twice. The first round found the two problems in the second and third points above, plus a cosmetic one: a leading space in a fallback This is now waiting on the maintainer. |
Normalize the ROM path for launcher execution and fallback IDs while keeping the supplied filename for the displayed game title. The same ROM now receives one launcher whether selected by an absolute or relative path, and its Exec argument remains usable after launch. Address the remaining Greptile finding on omacom#13935. Credit the original Muse escaping patch and maintainer reviews.
Exercise one ROM through both absolute and relative installs and require one usable desktop entry, alongside existing GLib round-trips. Keep the original test cases and original contributor credit.
|
Thanks @kvnloo. I read your two new commits (b71e511, 7d3848f) and compared this pull request with #9420, which fixes the same escaping bug in the same file. Nothing was run on a worker this pass. That was deliberate: the comparison settles which fix goes forward, and running this one again would not change that. #9420 is the fix that goes forward. It was opened first. With the commits I pushed here on 7 October, both pull requests escape
Two things in the new commits need fixing as they move across. I checked both by hand:
Codex Medium was asked separately which of the two should win, without my answer. It agreed that, for ROM paths, #9420 misses nothing this one fixes. It also confirmed both findings above. It reached the same conclusion I did, but it can read this session's work, so that agreement is not independent. It noted one difference in this PR's favour: #9420 would drop a trailing newline from a core path. I don't count that, because core paths come from installed libretro packages. This is now waiting on the maintainer to choose between the two. |
…uncher of its own Carried over from omacom#13935. The Exec line now names the game's absolute path, read NUL-delimited from realpath so a file name ending in a newline keeps it, so a launcher installed with a relative path still starts. A name that cleans to nothing, like "(Europe).sfc", keeps its raw file name instead of writing ".desktop", and a name with no ASCII letters or digits gets an id keyed on the game path, so two Japanese titles no longer overwrite one launcher. The test now starts each tricky entry through gio launch and checks the exact argv retroarch receives, since a file that reads right can still be one GLib refuses. Co-Authored-By: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desktop_exec_arg piped the path through sed inside a command substitution, which drops a newline ending the value, so a game whose file name ends in one got a launcher for a path that does not exist. Parameter expansion, as omacom#13935 escapes it, keeps every byte, and covers the core path the same way. Co-Authored-By: Kevin Rajan <7121943+kvnloo@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @kvnloo. I read your commits since the last review, 296ea7d through f7684b0. Nothing ran on a worker this pass. The question is still which of this and #9420 goes forward, and running this one again would not answer it. Both problems from my last comment are fixed:
#9420 still goes forward. It was opened first, and since the last review it has taken up the runtime changes this pull request introduced: the canonical ROM path, read the same NUL-delimited way, the raw-filename fallback name, and the path-hashed fallback id. On the escaping, neither one misses a case the other handles. What this pull request still adds is test coverage: test 4c's check that absolute and relative installs share one launcher, the full-entry line count in test 3, and the Codex Medium was asked separately which should go forward, without my answer, and it chose #9420 for the same reason. It also confirmed both fixes above. It flagged three smaller points, none of which changes the choice. The launch test here checks only the ROM argument, while #9420's checks the full argv. A ROM like This is waiting on the maintainer to choose between the two. |
|
Closing in favour of #9420, which is older and already carries this PR's runtime changes. #19965 (ec17b20) has since landed desktop-entry escaping, canonical paths and hashed fallback ids on quattro; the one gap left there (realpath in a command substitution drops a trailing newline in a file name) is covered by #9420's NUL-delimited read. Prepared by Claude Opus 5.5 via Hermes Agent; reviewed under kvnloo's account. |
What
The script interpolated paths/names raw into generated
.desktopfiles. Red-on-base proved four breaks:%/%Uun-doubled triggered launcher field-code expansion,Exec=key line (ROM names are untrusted input),(Europe).sfcwrote an invalid empty-Name.desktop.Fix
Spec-correct Exec quoting, string escaping for Name/Comment, and empty-name/id fallbacks.
Evidence
Posted by Kevin's agent on his behalf — AI-assisted contribution (Muse, Meta's Muse Spark) under the contributor's direction. The contributor reviewed the change and takes responsibility for it.