Skip to content

[Bug]: Generated "Desktop Entry" file uses wrong quotation and is considered "invalid" upon validation #4247

@ChillyVanilly77

Description

@ChillyVanilly77

Describe the bug

When performing the "programs list" entry context-menu action (currently) named "Add Desktop Entry",
the generated content of that Desktop Entry file uses single-quotes (') instead of double-quotes (") for arguments containing space(s) that aren't meant to separate args, but rather something like a name or so.

Generated Desktop Entry file for the fan-made "Pokemon Infinity":

[Desktop Entry]
Name=Pokemon Infinity
Exec=flatpak run --command=bottles-cli com.usebottles.bottles run -p 'Pokemon Infinity' -b 'Gaming' -- %u
Type=Application
Terminal=false
Categories=Application;
Icon=<some-base-path>/games/bottles/Gaming/icons/Pokemon Infinity.png
Comment=Launch Pokemon Infinity using Bottles.
StartupWMClass=Pokemon Infinity
Actions=Configure;
[Desktop Action Configure]
Name=Configure in Bottles
Exec=flatpak run com.usebottles.bottles -b 'Gaming'

When trying to "install" that Desktop Entry file using the utility desktop-file-install (which 1st performs a validation of the content) – since the sandboxed/flatpak app(s)-specific *.desktop-files aren't looked-up/included when searching for apps using some kind of "Applications"-look-up button or shortcut (like a "Start" menu button in KDE Plasma, or "Applications" in COSMIC etc.) – , it errors out with 6x "error"s, 1 for each present non-escaped single-quote.
Output:

/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run --command=bottles-cli com.usebottles.bottles run -p 'Pokemon Infinity' -b 'Gaming' -- %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run --command=bottles-cli com.usebottles.bottles run -p 'Pokemon Infinity' -b 'Gaming' -- %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run --command=bottles-cli com.usebottles.bottles run -p 'Pokemon Infinity' -b 'Gaming' -- %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run --command=bottles-cli com.usebottles.bottles run -p 'Pokemon Infinity' -b 'Gaming' -- %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run com.usebottles.bottles -b 'Gaming'" for key "Exec" in group "Desktop Action Configure" contains a reserved character ''' outside of a quote
/usr/share/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop: error: value "flatpak run com.usebottles.bottles -b 'Gaming'" for key "Exec" in group "Desktop Action Configure" contains a reserved character ''' outside of a quote
Error on file "/home/<username>/.var/app/com.usebottles.bottles/data/applications/Gaming--Pokemon Infinity--1764608204.090144.desktop": Failed to validate the created desktop file

According to the The Exec key section at the official freedesktop(dot)org website,
the single-quote is one of the "reserved" characters, and should therefore ideally just use the non-reserved one, i.e. double-quotation, or escaping the reserved chars instead.

To Reproduce

  1. Enter into some existing bottle
  2. Click the 3-dots button of a specific existing program from the list of programs to trigger its context menu
  3. select the action "Add Desktop Entry"
  4. Attempt to install (for it to show up in a "Start"-like menu or wherever one would look-up available apps) or just validate the produces Desktop Entry file located (probably) under the path ~/.var/app/com.usebottles.bottles/data/applications/<bottle-name>--<program-name>--<digits>.<digits>.desktop
  5. Observe produced error(s)

Package

Flatpak from Flathub

Distribution

CachyOS

Debugging Information

Official Package: true
Version: '60.1'
DE/WM: plasma
Display:
    X.org: true
    X.org (port): :0
    Wayland: true
Graphics:
    vendors:
        amd:
            vendor: amd
            envs:
                DRI_PRIME: '1'
            icd: /usr/share/vulkan/icd.d/radeon_icd.x86_64.json:/usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/radeon_icd.x86_64.json:/usr/lib/i386-linux-gnu/GL/vulkan/icd.d/radeon_icd.i686.json
    prime:
        integrated: null
        discrete: null
Kernel:
    Type: Linux
    Version: 6.17.9-2-cachyos
Disk:
    Total: 16695152640
    Free: 16694980608
RAM:
    MemTotal: 31.1GiB
    MemAvailable: 26.7GiB
Bottles_envs: null

Troubleshooting Logs

Additional context

NOTE: this may of course be considered an "overkill" bug report, but the primary intention is to have it properly logged as a ticket and provide addition help/infos for those users perhaps wondering about what that did exactly. If there are not current or future plans to handle those file "better" regarding "ease-of-use" for users, and should just be something rather documented for users on "How to …" do this for themselves, I would be happy to write a docs entry for this if desired, let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions