I could reproduce this problem using 18.04.3 live CD using Slack and
Atom. However, I don't think the problem is caused by snapd.

Slack, Skype and Atom are all classic snaps so they have full access to
the system. With Slack installed, clicking on the 'get started' link was
enough to get another Firefox window open. I collected the strace log. A
relevant piece is here:

10782 execve("/usr/local/sbin/xdg-open", ["xdg-open", 
"https://slack.com/ssb/add";], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such 
file or directory)
10782 execve("/usr/local/bin/xdg-open", ["xdg-open", 
"https://slack.com/ssb/add";], 0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such 
file or directory)
10782 execve("/usr/sbin/xdg-open", ["xdg-open", "https://slack.com/ssb/add";], 
0xb6c9467b000 /* 75 vars */) = -1 ENOENT (No such file or directory)
10782 execve("/usr/bin/xdg-open", ["xdg-open", "https://slack.com/ssb/add";], 
0xb6c9467b000 /* 75 vars */) = 0
10784 execve("/usr/bin/which", ["which", 
"gnome-default-applications-prope"...], 0x560d5fb594a8 /* 75 vars */) = 0
10784 +++ exited with 1 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10784, 
si_uid=999, si_status=1, si_utime=0, si_stime=0} ---
10785 execve("/usr/bin/gio", ["gio", "help", "open"], 0x560d5fb594a8 /* 75 vars 
*/) = 0
10785 +++ exited with 0 +++
10782 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10785, 
si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10786 execve("/usr/bin/gio", ["gio", "open", "https://slack.com/ssb/add";], 
0x560d5fb594a8 /* 75 vars */) = 0
10789 +++ exited with 0 +++
10786 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10789, 
si_uid=999, si_status=0, si_utime=0, si_stime=0} ---
10790 execve("/usr/local/sbin/firefox", ["firefox", 
"https://slack.com/ssb/add";], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No 
such file or directory)
10790 execve("/usr/local/bin/firefox", ["firefox", 
"https://slack.com/ssb/add";], 0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No 
such file or directory)
10790 execve("/usr/sbin/firefox", ["firefox", "https://slack.com/ssb/add";], 
0x563485f1c6e0 /* 77 vars */) = -1 ENOENT (No such file or directory)
10790 execve("/usr/bin/firefox", ["firefox", "https://slack.com/ssb/add";], 
0x563485f1c6e0 /* 77 vars */) = 0
10791 +++ exited with 0 +++

Notice how slack attempts to run xdg-open (and does so successfully at
some point), then it proceeds to run `gio open ..`, and again does that
successfully, finally it just runs firefox with the URL. I believe this
is what triggers the new window to appear.

Another observation for Slack on 18.04 is that gnome-shell groups the
Firefox window *with* the slack one.

I tried diffing the environment between the inside and outside of snap:

--- in-shell    2019-10-17 13:43:59.474529198 +0000
+++ in-snap-shell       2019-10-17 13:44:09.186624002 +0000
@@ -2,13 +2,14 @@ CLUTTER_IM_MODULE=xim
 COLORTERM=truecolor
 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/999/bus
 DESKTOP_SESSION=ubuntu
+DISABLE_WAYLAND=1
 DISPLAY=:0
 GDMSESSION=ubuntu
 GJS_DEBUG_OUTPUT=stderr
 GJS_DEBUG_TOPICS=JS ERROR;JS LOG
 GNOME_DESKTOP_SESSION_ID=this-is-deprecated
 GNOME_SHELL_SESSION_MODE=ubuntu
-GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/113b5986_bfcc_47c1_8317_a37a7600b396
+GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/d399bea3_fa8f_4330_842a_0eaaac439533
 GNOME_TERMINAL_SERVICE=:1.143
 GPG_AGENT_INFO=/run/user/999/gnupg/S.gpg-agent:0:1
 GTK_IM_MODULE=ibus
@@ -27,7 +28,22 @@ QT_ACCESSIBILITY=1
 QT_IM_MODULE=ibus
 
SESSION_MANAGER=local/ubuntu:@/tmp/.ICE-unix/4000,unix/ubuntu:/tmp/.ICE-unix/4000
 SHELL=/bin/bash
-SHLVL=1
+SHLVL=2
+SNAP_ARCH=amd64
+SNAP_COMMON=/var/snap/atom/common
+SNAP_CONTEXT=yBpkxSLRYnnStMxl74JWW8f6GLLQDXlD6qC2rdmXVjsh
+SNAP_COOKIE=yBpkxSLRYnnStMxl74JWW8f6GLLQDXlD6qC2rdmXVjsh
+SNAP_DATA=/var/snap/atom/238
+SNAP_INSTANCE_KEY=
+SNAP_INSTANCE_NAME=atom
+SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void
+SNAP_NAME=atom
+SNAP_REEXEC=
+SNAP_REVISION=238
+SNAP=/snap/atom/238
+SNAP_USER_COMMON=/home/ubuntu/snap/atom/common
+SNAP_USER_DATA=/home/ubuntu/snap/atom/238
+SNAP_VERSION=1.40.1
 SSH_AGENT_PID=4095
 SSH_AUTH_SOCK=/run/user/999/keyring/ssh
 TERM=xterm-256color
@@ -43,7 +59,7 @@ XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc
 XDG_CURRENT_DESKTOP=ubuntu:GNOME
 
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop
 XDG_MENU_PREFIX=gnome-
-XDG_RUNTIME_DIR=/run/user/999
+XDG_RUNTIME_DIR=/run/user/999/snap.atom
 XDG_SEAT=seat0
 XDG_SESSION_DESKTOP=ubuntu
 XDG_SESSION_ID=2

However I could still spawn a separate Firefox window using a simple
`gio open http://<url>`.

I've proceeded to install Chromium and set it to be my default browser.
At this point all the links and xdg-open calls I tried would open a new
tab in the current Chromium window.

Perhaps the problem is actually with Firefox and the method it uses to
find out whether there's antoher instance already running.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to xdg-utils in Ubuntu.
https://bugs.launchpad.net/bugs/1835024

Title:
  Links triggered within most snap apps open in a separate browser
  session

Status in snapd:
  New
Status in xdg-utils package in Ubuntu:
  New

Bug description:
  Hi,
  I've recently made a clean install of Ubuntu 19.10 (development release) and 
have noticed that whenever I try to open a link from one of the snap apps 
(being it Slack or Skype) the links although opened in the default browser are 
being opened in a separate session of the web browser.

  I am using Firefox and it is installed as a regular deb package
  (default).

  This is wrong and causes issues with history, sessions and settings
  not being shared between these windows. Now I have the default browser
  I use + a separate session for Slack and another one for Skype. Not to
  mention Firefox also acts just like another Slack/Skype window so dash
  displays these as two instances of the same app.

  To reproduce:
  * Install Ubuntu 19.10 (not sure if upgrade from 19.04 would lead to the same 
behaviour).
  * Confirm FFox is installed as a regular deb package.
  * Install I suppose almost any snap app, although I've only reproduced this 
with Slack and Skype and haven't tried to install other apps.

  System monitor also seems to be installed but when trying to open links from 
the about window - translators - individual names, it seems to do nothing.
  On the other hand Gnome calculator which is also installed as a snap package 
opens the link in the about dialog correctly = in my default browser session.

  ```
  :~# which gnome-calculator 
  /snap/bin/gnome-calculator
  ```

  Thank you very much for looking into that.

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/1835024/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to