onagre-launcher / onagre

A general purpose application launcher for X and wayland inspired by rofi/wofi and alfred
MIT License
514 stars 27 forks source link

Some desktop entries panic on launch #33

Closed oknozor closed 5 months ago

oknozor commented 2 years ago

Describe the bug Some desktop entries does not launch correctly :

Nov 04 10:42:22 havre /usr/lib/gdm-x-session[569481]: thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/app/mod.rs:417:74
Nov 04 10:42:22 havre /usr/lib/gdm-x-session[569481]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

yay -S conduktor
# then launch with onagre
jokeyrhyme commented 1 year ago

Yeah, I've only just today started having this issue, but there haven't been any updates to pop-launcher nor onagre in a while so it's not something that changed recently here

[2022-12-14T08:38:50Z DEBUG onagre::app::subscriptions::pop_launcher] Wrote request "{\"Activate\":0}\n" to pop-launcher stdin
[2022-12-14T08:38:50Z DEBUG onagre::app::subscriptions::pop_launcher] Got a response from pop-launcher
[2022-12-14T08:38:50Z DEBUG onagre::app::subscriptions::pop_launcher] Ok(DesktopEntry { path: "/var/lib/flatpak/exports/share/applications/org.mozilla.firefox.desktop", gpu_preference: Default })
...
[2022-12-14T08:38:50Z DEBUG onagre::app] Launch DesktopEntry "/var/lib/flatpak/exports/share/applications/org.mozilla.firefox.desktop" via run_command
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/app/mod.rs:358:74

I believe the line in the stack trace is this one: https://github.com/oknozor/onagre/blob/8d4ffe9f7f38cb2d1eb3023a128856c209100cf1/src/app/mod.rs#L358

Ah, okay, so, I put in some dbg!() in a few places, and it seems that this line results in an error: https://github.com/oknozor/onagre/blob/8d4ffe9f7f38cb2d1eb3023a128856c209100cf1/src/freedesktop/desktop.rs#L26

It's a problem with the Firefox flatpak .desktop file:

duplicate field Keywords

oknozor commented 1 year ago

Hey @jokeyrhyme thanks for reporting the issue. I'll look into it soon.

jokeyrhyme commented 1 year ago

It would be appreciated if there was a solution in onagre for this, but I feel like that actual bug is malformed .desktop files, which doesn't seem like the responsibility of onagre to address

Although, onagre doesn't need all the fields in the .desktop file, so maybe there's a bespoke/alternative parsing solution here that will extract just the bare minimum values?

It looks like pop-launcher itself uses a library made by that team

jokeyrhyme commented 1 year ago

Here's another malformed .desktop file that I've had to fix :)

https://phabricator.services.mozilla.com/D167300