Bug 414020 - Resolve symlinks when copying .desktop files into ~/.config/autostart
Summary: Resolve symlinks when copying .desktop files into ~/.config/autostart
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_autostart (other bugs)
Version First Reported In: 5.17.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Laurent Montel
URL:
Keywords: junior-jobs, usability
Depends on:
Blocks:
 
Reported: 2019-11-11 03:50 UTC by Szczepan Hołyszewski
Modified: 2022-12-01 04:13 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Szczepan Hołyszewski 2019-11-11 03:50:10 UTC
SUMMARY

Please allow overriding an autostart program's command by creating a user-owned copy of the desktop file if the original desktop file is not writable by the user.


STEPS TO REPRODUCE
1. Add slack as a program to autostart
2. Modify the command to add the -u switch to start slack minimized in systray
3. Try saving the program dialog

OBSERVED RESULT

Alert box saying "Cannot save properties. Insufficient permissions to save  /home/<user>/.config/autostart/slack.desktop." (backtranslated from Polish).

EXPECTED RESULT

It should just work.

SOFTWARE/OS VERSIONS
Linux 5.3.8-arch1-1 #1 SMP PREEMPT x86_64 GNU/Linux
Operating System: Arch Linux 
KDE Plasma Version: 5.17.2
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Kernel Version: 5.3.8-arch1-1
OS Type: 64-bit
Processors: 8 × AMD FX(tm)-8320 Eight-Core Processor
Memory: 15,6 GiB


ADDITIONAL INFORMATION

The error message refers to the location of the symlink. You cannot "save" a symlink, and attempt to save its target obviously hits insufficient permissions as the file is actually /usr/share/applications/slack.desktop and is owned by root.
Comment 1 Szczepan Hołyszewski 2019-11-11 03:51:47 UTC
To clarify the first sentence: I want the creation of user-owned copy to be performed automatically by systemsettings. It is of course possible to do that manually, but it shouldn't be necessary.
Comment 2 Nate Graham 2019-11-12 18:31:14 UTC
Works for me. Can you verify the permissions of ~/.config/autostart/slack.desktop Does that file exist and is it writable by your user? And are you running System Settings as your own user?
Comment 3 Szczepan Hołyszewski 2019-11-21 04:53:33 UTC
At this time I have a copy of the .desktop file in autostart, and I can freely modify the command using systemsettings autostart page. I may have simply copied it there in the meantime. But I distinctly remember that the file was originally a symlink to /usr/share/applications/slack.desktop, which is probably how Slack installs it when you configure autostart in Slack's options. And in THAT case the behavior was wrong. Systemsettings was unable to detect the "this file is a symlink to a file I don't own" condition. It should be able to do so, and create a "copy-on-write" of the unwritable file, replacing the symlink. The whole operation should be entirely transparent to the user who may not be a symlink-savvy technical person.
Comment 4 Nate Graham 2019-11-21 15:55:03 UTC
Thanks, confirmed. The bug is probably somewhere in here: https://cgit.kde.org/plasma-desktop.git/tree/kcms/autostart/autostart.cpp#n274