Bug 424973

Summary: .desktop shortcut does not resolve $HOME
Product: [Frameworks and Libraries] frameworks-kservice Reporter: Holger <h.klene>
Component: generalAssignee: David Faure <faure>
Status: REOPENED ---    
Severity: normal CC: a.samirh78, alexander.lohnau, kdelibs-bugs, nate
Priority: NOR    
Version: 5.68.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: broken shortcut written by the GUI

Description Holger 2020-08-03 20:22:37 UTC
SUMMARY

Usage of environment-variable in either working-directory or as path to executable will stop the program from running.

STEPS TO REPRODUCE
1. see screenshot in bug 167502 comment #4
2. create shortcut to e.g. executable bash-script with absolute path
3. check the shortcut works
4. incorporate some variable like $HOME

OBSERVED RESULT
program does not start anymore

EXPECTED RESULT
program starts, if $HOME is replaced verbose

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-42-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4700MQ CPU @ 2.40GHz
Memory: 15,6 GiB

ADDITIONAL INFORMATION
Comment 1 David Faure 2020-08-14 10:16:03 UTC
The properties dialog needs to use [$e] when writing out the desktop file, if it wants env vars to be expanded.
Like this:

Path[$e]=$HOME/src
Comment 2 David Faure 2021-04-21 12:08:46 UTC
This is as per the desktop entry spec (IIRC), not a bug. Please reopen if you disagree...
Comment 3 Holger 2022-03-28 20:37:08 UTC
Environment variables are still broken, though they are suggested by the editor interface. Please check the screenshot again:
https://bugsfiles.kde.org/attachment.cgi?id=130404

So either the editor must write the correct prefix into the file as:
Path[$e]=$HOME/src

Or it shall stop offering to use environment variables (which would be really sad!).

Bug 424974 has been fixed, to treat ~
Comment 4 Holger 2022-03-28 20:44:02 UTC
Created attachment 147808 [details]
broken shortcut written by the GUI

Even if I modify the shortcut manually in a text editor to use the "Path[$e]="-syntax, on loading in the GUI, it will "resolve" the variable, leaving me with a constant path at the time of editing. Still the dialog offers me to use variables, but writes it back as:
Path=$HOME
explicitly removing the [$e]