Created attachment 147067 [details] Error when trying to change Discord's desktop entry SUMMARY If user tries to edit a desktop entry in /usr/share/applications that is a symlink to some file without write access, this results in an error. STEPS TO REPRODUCE 1. Install a package that contains a symlink from /usr/share/applications. For example, Discord package on Arch/Manjaro: `pacman -S discord` 2. Open Application Launcher 3. Right-click on an app installed on step 1, select 'Edit application' 4. Change something and click 'Save' OBSERVED RESULT Error: Could not save properties due to insufficient write access to: ‘/home/roma/.local/share/applications/discord.desktop’. ~/.local/share/applications/discord.desktop is a symlink to /opt/discord/discord.desktop. EXPECTED RESULT ~/.local/share/applications/discord.desktop is successfully saved and is an arbitrary file owned by the current user. SOFTWARE/OS VERSIONS Linux distro: Manjaro stable KDE Plasma Version: 5.23.5, master KDE Frameworks Version: 5.90.0, master Qt Version: 5.15.2 ADDITIONAL INFORMATION Similar bug: https://bugs.kde.org/show_bug.cgi?id=394476 But it needs to be resolved separately IMO, since it involves editing a file that's already in `~/.local/share/applications/` but is unwriteable for the current user.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/768
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/848
Git commit a4be43231840a145c808f6ce81217f02f03935e8 by Ahmad Samir. Committed on 13/06/2022 at 19:19. Pushed by ahmadsamir into branch 'master'. KPropertiesDialog: fix saving changes when editing a .desktop file symlink Consider the use case of: /usr/share/applications/foo.desktop is symlink to /opt/someapp/foo.desktop relativeAppsLocation() was using QFile::canonicalFilePath(), which meant that foo.desktop would resolve to a file outside /usr/share/applications, since the code, rightly, expects files in QStandardPaths::ApplicationsLocation locations, m_sRelativePath would end up being empty, which makes the check in KFilePropsPlugin::slotCopyFinished() fail, and the .desktop file wouldn't get copied to ~/.local/share/applications/, and the saving would fail. FIXED-IN: 5.96 M +5 -3 src/widgets/kpropertiesdialog.cpp https://invent.kde.org/frameworks/kio/commit/a4be43231840a145c808f6ce81217f02f03935e8
The error message persists on Arch Linux when I try to edit 'Name' field in 'Application' tab of 'Edit application' window of Discord icon present in Favorites list of Kickoff. Operating System: Arch Linux KDE Plasma Version: 5.25.90 KDE Frameworks Version: 5.98.0 Qt Version: 5.15.6 Graphics Platform: Wayland
Still seeing this behavior on my machine, when editing any field. I'm particularly interested in adding to the "Environment Variables" field of Telegram flatpak Operating System: Nobara Linux 38 KDE Plasma Version: 5.27.6 KDE Frameworks Version: 5.107.0 Qt Version: 5.15.10 Kernel Version: 6.3.12-204.fsync.fc38.x86_64 (64-bit) Graphics Platform: X11 Processors: 12 × AMD Ryzen 5 3600X 6-Core Processor Memory: 31.2 GiB of RAM Graphics Processor: AMD Radeon RX 6700 XT Manufacturer: ASUS
*** Bug 451003 has been marked as a duplicate of this bug. ***
*** Bug 461941 has been marked as a duplicate of this bug. ***
The same happens with LibreOffice in Arch Linux. The libreoffice-fresh package contains files: /usr/lib/libreoffice/share/xdg/calc.desktop - the regular file /usr/share/applications/libreoffice-calc.desktop - a simlink pointing to /usr/lib/libreoffice/share/xdg/calc.desktop Now when I use "Edit Application" action, the file appears: ~/.local/share/applications/libreoffice-calc.desktop but it is not a regular desktop file, instead, it is a symlink to the /usr/lib/libreoffice/share/xdg/calc.desktop The utility should resolve symlinks, and copy the final desktop file, instead of literally copying the desktop file from /usr/share/applications (which could be a symlink).
*** Bug 486376 has been marked as a duplicate of this bug. ***