← Back to issue list

Valid desktop file without Exec key are rejected

View original Github issue

Metadata

Project
snapcraft
Number
#5799
Type
issue
State
closed
Author
didrocks
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Fixed by PR #6298 (commit ea842ae55), allowing valid desktop files without an Exec key while still rewriting Exec when present.

Resolution: closed resolved

Reason: Merged PR #6298, commit ea842ae55, made Exec optional during desktop-file processing so D-Bus- or systemd-activated NoDisplay entries are accepted.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Desktop files can have a missing Exec key and still be valid: - applications can be dbus activated - applications can be started by a systemd user unit. Under those conditions, we still want them to have a desktop file for the Shell to match a desktop entry with the application GUI. The typical use case is our prompting-client service, spawing a GUI when a snapd prompt is requested. This GUI has an associated icon and entry shown, but shouldn’t be started directly (it has NoDisplay=true). The Shell accepts it without Exec line. `desktop-file-validate` also raises no errors, but snapcraft rejects it due to this line: https://github.com/canonical/snapcraft/blob/2f1cc3677b329921f8a16a66615cf7b7de495515/snapcraft_legacy/internal/meta/desktop.py#L56 I think snapcraft should validate the desktop file using desktop-file-validate directly to not encode this kind of knowledge. ### To Reproduce * Ship a desktop file in `meta/gui` that don’t have a `Exec` entry. * Build the snap with `snapcraft` ### Environment * Snapcraft using LXD * Ubuntu questing (development version) ### snapcraft.yaml ```yaml Irrelevant for this bug report. ``` ### Relevant log output ```shell $ snapcraft Running snapcraft without a command will not be possible in future releases. Use 'snapcraft pack' instead. Pulling prompting-clienterror: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured. help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain. Failed to generate desktop file 'usr/share/applications/prompting-client-daemon.desktop': missing 'Exec' key Failed to execute pack in instance. Recommended resolution: Run the same command again with --debug to shell into the environment if you wish to introspect this failure. $ desktop-file-validate snap/gui/prompting-client.desktop -> no warning, no error ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by PR #6298 (commit ea842ae55), allowing valid desktop files without an Exec key while still rewriting Exec when present.
stealth/space-bunny-alpha — closed resolved Snapcraft now accepts valid desktop files without an Exec key; the fix was merged in canonical/snapcraft#6298 via commit ea842ae55.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #6298 (commit ea842ae55): Snapcraft now accepts valid desktop files without an Exec key.
stealth/space-bunny-alpha — closed resolved Fixed in merged PR #6298, commit ea842ae55: Snapcraft now permits desktop files without an Exec key.
stealth/space-bunny-alpha — closed resolved Snapcraft now accepts valid desktop files without an Exec key. Fixed by merged PR #6298 in commit ea842ae55, with updated tests.
qwen3.6-35b-a3b-mtp-q6 — — Closed without a fix. Maintainers confirmed the bug but declined external contributions due to legacy code complexities. The issue was escalated to internal Jira ticket SNAPCRAFT-1232 for future resolution.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 27
Staleness: 55
Complexity: 40
Confidence: 62
Support Request: 5
keep open Snapcraft rejects valid desktop files lacking an Exec key (needed for D-Bus/systemd-activated apps). Triaged and confirmed by a maintainer; a fix (PR #6298) is present in the codebase making Exec reformatting conditional.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 45
Confidence: 80
Support Request: 5
keep open Valid desktop files missing the Exec key are incorrectly rejected by snapcraft during build. The bug is triaged, confirmed by maintainers, and tracked internally, but has seen no external progress in nearly 10 months.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 65
Confidence: 85
Support Request: 5
keep open Snapcraft rejects valid desktop files missing the Exec key, which are allowed for D-Bus or systemd activation. The bug is triaged and confirmed by maintainers, but currently blocked on an internal fix due to legacy code considerations.

Update history

Date Change
closed

Related work

  • Likely Fixed By: canonical/snapcraft#6298 (confidence 100%)

    The merged change updates desktop-file handling to process Exec only when the key exists.

Related issues

Issue Project State Summary Similarity
#6298 fix: allow desktop files without an Exec key snapcraft merged Merged PR #6298 (commit ea842ae55) makes Snapcraft accept desktop entries lacking an Exec key, fixing #5799; Exec reformatting now only runs when the key exists and test_missing_exec_entry was updated.
77%
#1061 Fix Exec key in desktop files for apps named like their parent package (LP: #1658123). snapcraft merged Merged PR #1061 fixed desktop-file Exec keys for apps whose names match their parent package, resolving LP #1658123 in commit b393badb4.
72%