alexlarsson/xdg-app

xdg-app is wayland only?

Closed this issue · 16 comments

Hi Alex,

Is xdg-app wayland only?

There is org.gnome.gedit`s metadata

[Environment]                                                                   
x11=true                                                                        
wayland=true

But run xdg-app run org.gnome.gedit under X11 such as GNOME, it thrown such warning, and gedit is not visible!

(gedit:2): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.
No protocol specified

** (gedit:2): WARNING **: Could not open X display
No protocol specified

(gedit:2): Gtk-WARNING **: cannot open display: :99.0

And I experienced limba https://github.com/ximion/limba before, and I am also a hacker for weston:

When run weston-launch with different ttyN, then run xdg-app run org.gnome.gedit it is able to run happily shown as below:

wayland-screenshot

wayland-screenshot1

If set wayland=false, it thrown such error Gtk-WARNING **: cannot open display so wayland access control is able to work, but why x11 is not able to, is xdg-app wayland only?

Regards,
Leslie Zhai

Hmm, maybe your X server is set up in a different way.
What happens when you allow X11 in an app is that at runtime we look at the DISPLAY env var.
Say it is ":2.0". We then take the unix domain socket for this, which is "/tmp/.X11-unix/X2", and we bind mount it to "/tmp/.X11-unix/X99" in the app, then we set the DISPLAY inside the sandbox to ":99.0" which should make it look at the right socket address and connect to the right xserver.

Maybe your Xserver does not listen to a unix domain socket or something like that?

Hi @alexlarsson

Thanks for your quick reply ;-)

I follow the https://wiki.gnome.org/Projects/SandboxedApps perhaps I miss some important thing?

And I use ArchLinux enabled testing in pacman.conf, so there are gcc 5.x and other test purpose _fresh_ thing ;-)
I did not change DISPLAY env, and `export | grep DISPLAY`` output is declare -x DISPLAY=":1"

I will read xdg-app and relative source code to be familiar with gnome 3.6 sandboxed application, it is awesome!

Regards,
Leslie Zhai

If DISPLAY, is ":1", do you have a file (socket) called "/tmp/.X11-unix/X1"

yes!

[zhaixiang@archlinux .X11-unix]$ ls -la
total 0
drwxrwxrwt  2 root      root  140 Apr 24 15:49 .
drwxrwxrwt 16 root      root  680 Apr 24 16:56 ..
srwxrwxrwx  1 root      root    0 Apr 24 11:05 X0
srwxrwxrwx  1 zhaixiang users   0 Apr 24 13:47 X1
srwxr-xr-x  1 gdm       gdm     0 Apr 24 13:38 X1024
srwxr-xr-x  1 gdm       gdm     0 Apr 24 13:46 X1025
srwxr-xr-x  1 zhaixiang users   0 Apr 24 15:49 X2
``

And if you run "xdg-app run --command=sh org.gnome.gedit" to get a shell inside the app, do you have a "/tmp/.X11-unix/X99" file?

tty0 -> gdm
tty1 -> my own DE ;-)
tty2 -> weston or orbital https://github.com/giucam/orbital

And if you run "xdg-app run --command=sh org.gnome.gedit" to get a shell inside the app, do you have a "/tmp/.X11-unix/X99" file?

nope ;-(

And if you run "xdg-app run --command=sh org.gnome.gedit" to get a shell inside the app, do you have a "/tmp/.X11-unix/X99" file?
nope ;-(

Indeed I run xdg-app run --command=sh org.gnome.gedit in tty2 -> my own DE

What does "ps auxwww | grep xdg-app-helper" output?
Mine says:

/gnome/bin/xdg-app-helper -l -m /run/user/1000/xdg-app-monitor -x /tmp/.X11-unix/X0 -y /run/user/1000/wayland-0 -ifn -b /run/host/fonts /usr/share/fonts -a /home/alex/.local/share/xdg-app/app/org.gnome.gedit/x86_64/master/active/files -I org.gnome.gedit /home/alex/.local/share/xdg-app/runtime/org.fedoraproject.org/x86_64/1.0/active/files sh

Of importance here is the -x /tmp/.X11-unix/X0 part. Yours should have -x /tmp/.X11-unix/X1 if xdg-app found the display.

yes, there is _-x /tmp/.X11-unix/X1_

zhaixia+  1425  0.0  0.0   4192   760 pts/1    S    17:34   0:00 /usr/bin/xdg-app-helper -l -m /run/user/1000/xdg-app-monitor -x /tmp/.X11-unix/X1 -ifn -b /run/host/fonts /usr/share/fonts -a /home/zhaixiang/.local/share/xdg-app/app/org.gnome.gedit/x86_64/master/active/files -I org.gnome.gedit /home/zhaixiang/.local/share/xdg-app/runtime/org.gnome.Platform/x86_64/3.16/active/files sh

But I have no idea why gedit is not visible ;P I have to read xdg-app relative source code, I am a newbie in gnome sandboxed application world.

Hi @alexlarsson I have to gotta home now, so happy weekend, see you next week ;-)

You should try "sudo xhost +" in Terminal. Then try to start the program. This seems to be a permissions issue for some reason on Arch Linux. @alexlarsson gave me this hint on G+ 1-2 months ago.

Hi @Blackout24 thanks for your advice ;-) it worked for Arch Linux https://wiki.archlinux.org/index.php/Running_X_apps_as_root

@timjp87 I think that running that command is a bad idea because anyone on your network could access your X server and run programs on it or gain access using a XORG exploit.

Is there any way we could only allow localhost to connect

@SuicSoft The bug that caused this was due to a certain xauth configuration. Recent xdg-app versions work around this, so xhost + should not be needed anymore.

Ok