Public bug reported: According to spec/documentation, "implementations must undo quoting before expanding field codes and before passing the argument to the executable program."
https://developer.gnome.org/desktop-entry-spec/#exec-variables lightdm fails to do so and passes the double-quote characters to the executable program. Consider the following files: myecho: #!/bin/bash echo "$1" > /tmp/cmd /usr/share/xsessions/test.desktop: [Desktop Entry] Name=Test Comment=This is a test session Type=Application Exec=myecho "argument" myecho is to be located somewhere in the PATH. When trying to start a desktop session defined by test.desktop, as a result of running myecho, the first command-line argument from the Exec is written to /tmp/cmd. Here is where lightdm is wrong: Starting the 'test' session under lightdm causes '"argument"' (without the surrounding single quotes) to be written to /tmp/cmd. The correct string should be 'argument' (without the surrounding single quotes). If the double-quotes are removed from the Exec line, lightdm behaves normally and 'argument' is written. A practical consequence of this bug is that users can't use "bash -c" to run multiple commands when special characters (including spaces) are needed in the argument after "-c". It seems that the user must resort to a wrapper script because of this bug. $ lsb_release -rd Description: Ubuntu 19.04 Release: 19.04 $ apt-cache policy lightdm lightdm: Installed: 1.28.0-0ubuntu1 Candidate: 1.28.0-0ubuntu1 Version table: *** 1.28.0-0ubuntu1 500 500 http://mirrors.yun-idc.com/ubuntu disco/universe amd64 Packages 100 /var/lib/dpkg/status ** Affects: unity-settings-daemon (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to unity-settings-daemon in Ubuntu. https://bugs.launchpad.net/bugs/1848849 Title: Lightdm fails to undo quoting for Exec key Status in unity-settings-daemon package in Ubuntu: New Bug description: According to spec/documentation, "implementations must undo quoting before expanding field codes and before passing the argument to the executable program." https://developer.gnome.org/desktop-entry-spec/#exec-variables lightdm fails to do so and passes the double-quote characters to the executable program. Consider the following files: myecho: #!/bin/bash echo "$1" > /tmp/cmd /usr/share/xsessions/test.desktop: [Desktop Entry] Name=Test Comment=This is a test session Type=Application Exec=myecho "argument" myecho is to be located somewhere in the PATH. When trying to start a desktop session defined by test.desktop, as a result of running myecho, the first command-line argument from the Exec is written to /tmp/cmd. Here is where lightdm is wrong: Starting the 'test' session under lightdm causes '"argument"' (without the surrounding single quotes) to be written to /tmp/cmd. The correct string should be 'argument' (without the surrounding single quotes). If the double-quotes are removed from the Exec line, lightdm behaves normally and 'argument' is written. A practical consequence of this bug is that users can't use "bash -c" to run multiple commands when special characters (including spaces) are needed in the argument after "-c". It seems that the user must resort to a wrapper script because of this bug. $ lsb_release -rd Description: Ubuntu 19.04 Release: 19.04 $ apt-cache policy lightdm lightdm: Installed: 1.28.0-0ubuntu1 Candidate: 1.28.0-0ubuntu1 Version table: *** 1.28.0-0ubuntu1 500 500 http://mirrors.yun-idc.com/ubuntu disco/universe amd64 Packages 100 /var/lib/dpkg/status To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/unity-settings-daemon/+bug/1848849/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : desktop-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp