g_app_info_get_executable doesn't work well on latest Ubuntu with Firefox installed as snap
Hi,
I was investigating an issue in Eclipse IDE, and found that the root cause might be in Gio.
To reproduce the issue, you can use this sample code:
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <stdio.h>
int
main (int argc,
char **argv)
{
GAppInfo* appInfo;
appInfo = g_app_info_get_default_for_type("text/html", false);
printf("%s\n", g_app_info_get_name(appInfo)); // Navigateur Web Firefox
printf("%s\n", g_app_info_get_executable(appInfo)); // env
return 0;
}
As you can see, the g_app_info_get_executable
call returns env
while the caller is expecting to get a command like firefox
.
$ xdg-mime query default text/html
firefox_firefox.desktop
On my Ubuntu installation, Firefox is installed as a snap package (not sure it has any relation with the issue). The content of the /var/lib/snapd/desktop/applications/firefox_firefox.desktop
file Exec
attribute is:
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/firefox_firefox.desktop /snap/bin/firefox %u
I don't know how g_app_info_get_default_for_type
is implemented internally, but it seems that having the env
command prefixing the /snap/bin/firefox
command is contributing to the issue.
Edited by Julien HENRY