Dear GTK/GNOME list, I'm looking for help with a problem in the reportbug GTK ui (bug #964846). The GTK ui has code that uses VTE to run certain commands in a terminal. These commands include package-specific bug scripts and user-selected external MUAs used for bug submission. The problem is that MUA invocation often fails if xdg-email is used.
Since the MUA selection is a user choice, the current code does not know in advance whether the MUA needs a terminal or not, and therefore always spawns the terminal to launch the MUA. This works fine for most MUAs, but does not work reliably when trying to use xdg-email to launch the user's preferred MUA. See below for the observations so far. Is there a simple way to change the terminal-based command invocation in reportbug's GTK ui in a way that will work reliably with xdg-email? What changes are needed? (Would a change from Vte.terminal.spawn_sync to Vte.terminal.spawn_async make a difference? What exactly needs to be changed for this?) Or is it fine to stick with spawn_sync and we should instead try harder to only use terminal-based command invocation if a terminal is really needed? (That is probably a good idea anyway, but does not provide an explanation of why the current code is failing.) The code is here: https://salsa.debian.org/reportbug-team/reportbug/-/blob/master/reportbug/ui/gtk_ui.py#L1467 On 11/07/2020 11:34, Paul Wise wrote: > If I add some debugging to the SystemPage execute function from the > gtk_ui.py file to print the xdg-email command that is run under a VTE > terminal. I then copied the command into a GNOME Terminal and it ran > there just fine. I then commented out the self.terminal.spawn_sync call > and the black screen in the reportbug UI stayed around instead of > closing immediately. Then I tested subprocess.run() instead of Vte > spawn_sync and it worked. Then I tested the mutt reportbug option and > it worked fine. Then I tested setting the reportbug mua option to the > evolution MUA (which xdg-email opens normally) and it worked fine. Then > I hacked the code to append "; sleep inf" to the command being run and > xdg-email worked fine. Then I tried "; sleep 0.1s" and it did not work. > 0.5s does not work but 0.9s does work. So I think there is some sort of > race condition within VTE or something. So I added the sleep hack (set to 3s) and tried "mua xdg-email" in a few variants: Desktop preferred MUA Result Gnome evolution compose window opened, then closed within 3s Gnome thunderbird compose window opened, no problem Gnome claws-mail compose window opened, then closed within 3s Then I commented out the special casing of thunderbird in the gnome3 part of xdg-email, and thunderbird starting showing the same problem: the compose window was killed within 3 seconds. Then I tried to reproduce in Xfce (on stable, not sid): Xfce evolution compose window opened, then closed within 3s Xfce thunderbird does not work due to #964799 Xfce sylpheed compose window opened, then closed within 3s After fixing #964799, the problem also shows with thunderbird. > BTW, while debugging I saw this deprecation warning: > > <stdin>:1: DeprecationWarning: Vte.Terminal.spawn_sync is deprecated > https://developer.gnome.org/vte/unstable/VteTerminal.html#vte-terminal-spawn-sync