fix: allow desktop files without an Exec key - #6298
Open
WaiHlyanMinThein17 wants to merge 1 commit into
Open
Conversation
Desktop entries that are D-Bus- or systemd-activated (commonly with NoDisplay=true) are valid without an Exec key, per the Desktop Entry specification and desktop-file-validate. Snapcraft was rejecting them with "missing 'Exec' key". Only reformat the Exec line when present. Fixes canonical#5799
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.
Fixes #5799
Desktop entries without an
Execkey are valid when the application is D-Bus- or systemd-activated (often withNoDisplay=true), so the shell can still match an icon and metadata to a GUI that isn't launched directly.desktop-file-validateaccepts such files, but snapcraft rejected them withmissing 'Exec' key.This makes the
Execreformatting conditional on the key being present instead of raising when it's absent, so the file is written through unchanged. The separate "missing Desktop Entry section" guard is untouched. The existingtest_missing_exec_entryis converted from asserting rejection to asserting the file is written faithfully without anExecline.The issue suggested delegating validation to
desktop-file-validaterather than encoding key requirements in snapcraft. I went with this minimal in-tree fix to keep it focused and avoid a new external dependency, but I'm happy to take the delegation approach if the team prefers it.ruff,ty, andmake test-fast(3628 passed, 0 failed) all pass.make lintfails locally only in its docs build (TypeError: issubclass() arg 1 must be a class, Sphinx on Python 3.14); I confirmed the same failure on a cleanupstream/main, so it's pre-existing and unrelated to this change.make lint && make test. (Code linters andmake test-fastpass;make lintdocs build fails identically on cleanmain.)