snapd doesn't parse INI group in autostart file

Bug #1997163 reported by Ilya Fedin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Let's say we have such a .desktop autostart file:

[Desktop Entry]
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
TryExec=/snap/telegram-desktop/x7/usr/bin/telegram-desktop
Exec=/snap/telegram-desktop/x7/usr/bin/telegram-desktop -workdir /home/ilya/snap/telegram-desktop/common/ -autostart
Icon=${SNAP}/meta/gui/icon.png
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
Actions=Quit;
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true

[Desktop Action Quit]
Exec=/snap/telegram-desktop/x7/usr/bin/telegram-desktop -workdir /home/ilya/snap/telegram-desktop/common/ -quit
Name=Quit Telegram
Icon=application-exit

The expected result is snapd will use Desktop Entry/Exec command, the actual result is it uses Desktop Action Quit/Exec command leading to application not starting

Revision history for this message
Alberto Mardegan (mardy) wrote :

Hi Ilya, can you please tell me how to reproduce the issue?

snapd is not starting applications itself; do you mean to say that the .desktop file generated by snapd contains the wrong commands?

Revision history for this message
Ilya Fedin (ilya-fedin) wrote :

> snapd is not starting applications itself

snap userd --autostart command is a part of snapd, right? If yes then it does.

> do you mean to say that the .desktop file generated by snapd contains the wrong commands?

No, I set the apps.<app-name>.autostart to a .desktop file name and then the application creates a .desktop file with such name in $SNAP_USER_DATA/.config/autostart, with the content I provided in first message.

> Hi Ilya, can you please tell me how to reproduce the issue?

Try to use the apps.<app-name>.autostart feature with a .desktop file with multiple INI groups, like e.g. the one I provided.

Revision history for this message
Ilya Fedin (ilya-fedin) wrote (last edit ):

It just goes in a loop splitting the lines by "=" rather than using a proper INI parser and getting proper keys from the "Desktop Entry" group
https://github.com/snapcore/snapd/blob/3148402e0fb63d48608066e91129161dc976f9ef/usersession/autostart/autostart.go#L98-L138

Alberto Mardegan (mardy)
Changed in snapd (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.