Bug#1053446: xdg-email portal unavailable after default install

2023-10-04 Thread Simon McVittie
On Wed, 04 Oct 2023 at 10:57:18 +0200, Alec Leamas wrote:
> After a default install + installing flatpak the xdg-email portal does not
> work.

A default install of what exactly? What steps can be followed to reproduce
this problem?

The reason I ask is that Flatpak apps can't run the /usr/bin/xdg-email
from the host system, so if your steps to reproduce involve something
happening inside a Flatpak app that will run xdg-email from the PATH,
a dependency on xdg-utils on the host is not going to have the effect
that you're hoping for.

Inside a Flatpak app, none of the programs installed from .deb packages in
the host's /usr/bin are available. Instead, /usr comes from the Flatpak
runtime. If the app wants to be able to run xdg-email, then either the
app or its runtime needs to include the same code that is available
in Debian's flatpak-xdg-utils package (but, again, installed inside
the Flatpak app or runtime, not on the host system, so a dependency on
flatpak-xdg-utils on the host would not be helpful).

For example, the reference runtime org.freedesktop.Platform contains
a /usr/bin/xdg-email executable compiled from the same codebase as
Debian's flatpak-xdg-utils package (at least, version 22.08 does,
I haven't checked older or newer branches). This means that derived
runtimes like org.gnome.Platform//44 also contain that executable.

> Since the xdg-email portal requires xdg-utils

It does not. It requires any email client on the host system, either
installed from a .deb or a Flatpak app (or a Snap app or anything else
that participates in the freedesktop.org ecosystem), that registers
itself in a .desktop file as a freedesktop.org MIME-type handler for the
pseudo-MIME-type "x-scheme-handler/mailto". For example, thunderbird or
mutt would be suitable.

This is the same thing that xdg-utils requires in order to have the
xdg-email executable work, in any desktop environment that doesn't have
its own special code path in xdg-utils.

Steps to demonstrate this, starting from a virtual machine image produced
by autopkgtest-build-qemu, which has no graphical environment installed
and should be approximately equivalent to an installation from
debian-installer with no tasks enabled:

# apt install openbox xdm xorg flatpak mutt xterm
# apt purge xdg-utils
Package 'xdg-utils' is not installed, so not removed
# reboot
(GUI: log in to xdm, right-click on background, open a terminal)
$ flatpak remote-add --user --if-not-exists flathub flathub 
https://dl.flathub.org/repo/flathub.flatpakrepo
$ flatpak install --user flathub org.freedesktop.Platform//22.08
$ flatpak run org.freedesktop.Platform//22.08
[inside Flatpak app's shell]$ xdg-email nob...@example.com
(GUI: a new xterm opens, running mutt)

or for a more GUI reproducer, replace the last few steps with:

$ flatpak remote-add --user --if-not-exists flathub flathub 
https://dl.flathub.org/repo/flathub.flatpakrepo
$ flatpak install --user flathub com.belmoussaoui.ashpd.demo
$ flatpak run com.belmoussaoui.ashpd.demo
(GUI: go to Email tab, fill in Addresses: nob...@example.com, click Request)
(GUI: a new xterm opens, running mutt)

smcv



Bug#1053446: xdg-email portal unavailable after default install

2023-10-04 Thread Alec Leamas

Package: flatpak
Version:  1.14.3-1

After a default install + installing flatpak the xdg-email portal does 
not work. The reason is that the native xdg-email application is not 
available, it is part of the xdg-utils package which not is pulled in by 
the flatpak package.


According to the descripion, the flatpak package "contains the services 
and executables needed to install and launch sandboxed applications, and 
the portal services needed to provide limited access to resources 
outside the sandbox."


Since the xdg-email portal requires xdg-utils, the flatpak package IMHO 
thus should add a "Depends: xdg-utils" or possibly "Recommends",  either 
directly in the flatpak package or indirectly in for example 
xdg-desktop-portal.