https://bugs.kde.org/show_bug.cgi?id=526702

            Bug ID: 526702
           Summary: A user-local `.desktop` file with `Hidden=true` does
                    not mask the system desktop file with the same ID. The
                    system entry stays in ksycoca.
    Classification: Frameworks and Libraries
           Product: frameworks-kservice
      Version First 6.3.0
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

### Description

The Desktop Entry Specification says `Hidden=true` means the application should
be treated as deleted. It exists so that a user can hide a system-wide entry by
putting a file with the same desktop file ID earlier in
`$XDG_DATA_DIRS`/`$XDG_DATA_HOME`.

With KService 6.30.0, this does not work. Steps:

1. Run:

   ```
   printf '[Desktop Entry]\nHidden=true\n' >
~/.local/share/applications/firefox.desktop
   kbuildsycoca6 --noincremental
   ```

2. Check whether the service is still known, for example with `strings -el
~/.cache/ksycoca6_* | grep -x firefox.desktop`, or through any
`KApplicationTrader::query()` / `KService::serviceByDesktopName("firefox")`
lookup.

**Actual:** `firefox.desktop` from `/usr/share/applications` is still in the
database, along with all its properties (its Exec lines and
`StartupWMClass=firefox` are present in the ksycoca file), and
KApplicationTrader queries return it. In my case, this meant hiding it had no
effect on the Task Manager behaviour described in Report 1.

**Expected:** the service is absent from ksycoca, as if the system file had
been deleted.

**Note:** a *valid* user-local file with the same name does correctly replace
the system entry. Only the `Hidden=true` case falls through.

### Likely cause

In `src/sycoca/vfolder_menu.cpp`, `VFolderMenu::loadApplications()` scans each
application directory. For each file it calls `createService()`, and only when
a service is returned does it call `addApplication(id, service)` (which
"replaces, if already there"). For a `Hidden=true` file,
`KBuildServiceFactory::createEntry()` returns `nullptr` ("Deleted/Hidden
Service"), so nothing is recorded for that ID. The entry from the other
directory, which is a real service, is kept. A hidden entry from a
higher-priority directory should remove or suppress the ID instead.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to