mirror of
https://github.com/morluto/rea.git
synced 2026-11-10 00:36:35 +00:00
fix(desktop): resolve desktop entry ids that name a nested entry (#9563)
* fix(desktop): resolve desktop entry ids that name a nested entry The desktop file id of an entry below an applications folder replaces the directory separators with dashes, so applications/vendor/foo.desktop advertises vendor-foo.desktop. locateDesktopEntry only probed the flat path, so such an entry was either not found or, when a lower-priority XDG root installed a flat file with the same id, a different application was launched under the requested id. List each applications directory instead and form every entry's id from the path that holds it, so a dash inside a directory name does not change the answer. The walk is bounded and stops reporting absence once it can no longer decide, so a truncated search refuses instead of falling through to a lower-priority root. * fix(desktop): search nested entry directories without skipping answers Three defects in findNestedDesktopEntry, all of which could select a lower-priority application under the same desktop file id: `readdir` failure was treated as an empty directory, so an applications root or nested directory that could not be listed silently yielded to a lower-priority root. Only ENOENT and ENOTDIR now mean the root is not installed; any other failure reports desktop_entry_search_incomplete. A directory whose own name ends in `.desktop` was skipped before it was searched, so `vendor.desktop/app.desktop` (id `vendor.desktop-app.desktop`) was unreachable. The suffix now selects a candidate only for files; directories still descend. The entry budget was applied after `readdir` had materialized every name, so a large directory allocated far more than the 4096 entries it may examine. The walk now enumerates with `opendir` and charges the budget per entry. * fix(desktop): finish the reachable nested search before reporting a gap An unreadable or over-budget subtree is not proof the entry is absent, but returning truncated as soon as one was met stopped the walk before the siblings that could still hold it. The entry then looked incomplete even though this root could answer, so a lower-priority root was never consulted and the search reported a gap instead of the entry. * test(javascript): distinguish package scope in route fixtures * test(apple): separate identity and refusal fixture groups * fix(desktop): resolve only applicable desktop ID paths * test(desktop): cover applicable probe failure before a matching spelling --------- Co-authored-by: 2SinceJuly <202121119+2SinceJuly@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
4 files changed
+471
-5
No files matched your search
@@ -47,6 +47,13 @@ computer would not have that entry. An `--executable` runs from
|
||||
the current directory, as it would from a shell, and a relative path to it is
|
||||
resolved there.
|
||||
|
||||
A nested desktop file uses a dashed ID: `vendor/app.desktop` has ID
|
||||
`vendor-app`. REA checks path spellings that can encode that ID within each
|
||||
XDG root before trying the next root. Unrelated directories do not affect
|
||||
selection. If an applicable path cannot be examined or the bounded search
|
||||
cannot establish absence, capture reports an incomplete desktop-entry search
|
||||
rather than selecting a different application from a later root.
|
||||
|
||||
Desktop-entry string values retain literal trailing spaces. For example,
|
||||
`Path=/tmp/workspace ` and `Path=/tmp/workspace\s` name the same directory
|
||||
ending in a space. Use the escaped spelling to make such a suffix visible.
|
||||
|
||||
Reference in new issue
Block a user