Improving flatpak override's errors (and, maybe, app specification consistency in general)
If I have a Flatpak app installed to my user but not my system, attempting to override produces a permissions error if I don't specify the right context (given that it defaults to "system"):
[straussd@t580 ~]$ flatpak override --filesystem=$SSH_AUTH_SOCK org.gnome.Builder
error: Permission denied
While I understand why I get this error, most Flatpak subcommands either ask me if I want to run the command against a matching app in my user instance (even when I'm using the default of --system
) or even silently switch to matching on system or user.
These both work (by silently falling back to --user
):
[straussd@t580 ~]$ flatpak update org.gnome.Builder
[straussd@t580 ~]$ flatpak run org.gnome.Builder
So, I spent a few minutes confused about why my override wouldn't work before I realized that I explicitly needed --user
to apply it to my user installation of Builder. I would consider informing the user that the override function cannot find the specified app, similarly to what you get from the update subcommand:
[straussd@t580 ~]$ flatpak update org.gnome.Builder2
Looking for updates…
error: org.gnome.Builder2 not installed
I would have figured out my mistake much faster if Flatpak told me it couldn't find the app, particularly if the error mentioned "in the --system context."
In general, though, there seems to be inconsistency in how system/user contexts affect different subcommands. I feel like they should all operate with a consistent approach when neither --user
nor --system
is specified.
Perhaps it could be one of these:
- Always attempt against
--system
first, falling back to--user
if there's no match in--system
(or vice versa). It could warn or get user confirmation if this occurs. If both contexts have a matching app, it might be safest to ask or just fail. - Be strict about the context, never searching or asking about the one that's not active. It would be good to suggest when there's a lack of match that the context might be wrong.
- Search both
--system
and--user
. Even if there's only one match, confirm the choice with the user. Scripts would be encouraged to always be explicit.