Bug 487927 - Launcher creation adds single quotes to application, preventing ~ expansion.
Summary: Launcher creation adds single quotes to application, preventing ~ expansion.
Status: CONFIRMED
Alias: None
Product: frameworks-kconfig
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 6.3.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Matthew Dawson
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-06-02 14:54 UTC by Emmett Culley
Modified: 2024-06-12 17:45 UTC (History)
4 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 Emmett Culley 2024-06-02 14:54:36 UTC
SUMMARY
Not sure when this started as I have a mix of desktop objects that have the application bracketed with single quotes in the .desktop file, and some that don't.  When I create a launcher now, however, single quotes are always  added in the .desktop file.

However, I don't believe ading single quotes to the application string is the bug.  At least one of the .desktip objects that have single quotes around the application and they worked fine before the upgrade to plasma 6.

If I create a launcher using the "browse" button to find and enter the application, the launcher works as expected.  So I believe the issue is that with quotes around the application, shell expansion on the '~" character doesn't happen, and so the launcher cannot find the application/script it is supposed to run.  Indeed, that is the error notification I see when attempting to use a "bad" launcher.

STEPS TO REPRODUCE
1.  Create launcher entering ~/bin/script_name to the application field.
2.  Click on launcher

OBSERVED RESULT
 Intended script does not run and a "could not find the program" error notification pops up.

EXPECTED RESULT
~/bin/srcipt_name should run.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora Linux 40
(available in About System)
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version:  6.7.0

ADDITIONAL INFORMATION
Kernel version: 6.8.10-300.fc40.x86_64 (64-bit)
Currently running wayland.
Comment 1 Nate Graham 2024-06-11 22:56:50 UTC
Generally you shouldn't need to add quotes yourself. Can you provide an example of exactly what you're typing and exactly what it ends up a in the resulting .desktop file? Also, in what app are you creating these desktop files? KMenuEdit or the properties dialog?
Comment 2 Emmett Culley 2024-06-12 14:27:53 UTC
Normally I use the launcher edit dialog.  I enter a path to a script and save, and it works as expected.  However, if the path include ~ I get a "Could not find program ~/bin/script_name".  If it then edit the .directory file and remove the single quotes the launcher edit process added and save.  Then the launcher doe work as expected that the script ~/bin/script_name does run.

I only mention adding single quotes because I noticed that old launcher files on my system do not have that single quotes added and they still work.  Since my upgrade to fedoraa 40, some no longers worked and in all cases I found single quotes around the script spec.  

I see two issues.  One that some upgrade started adding single quotes to the script spec on launcher edit save.  That caused no propblem, as all launchers still worked.

But since upgrade  to fedora 49 and KDE to 6, launchers script specs with a ~ no longer work.  Unless I remove the single quotes from the launcher .directory file.

Hence my suspician that what changed is bash expansion on the launcher script spec failes to translate ~ to my home directory.

All I have to do to see this issue is right click on any launcher, alter the Program spec in anyway and save.   the spec in the .directory file will now be wrapped in single quotes,  even if it didn't before.  If the spec contained a ~ then the launcher no longer works.

I hope this helps.
Comment 3 Nate Graham 2024-06-12 17:45:06 UTC
Can confirm. Perhaps something changed in KDesktopFile.