Bug 442362

Summary: xwayland: Add local user to xhost
Product: [Plasma] kwin Reporter: walktmp+s3q7a
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: benn.snyder, nate, sam
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.23.4

Description walktmp+s3q7a 2021-09-13 02:12:09 UTC
Trying to run something under Xwayland, properly, as a different user is beyond a headache in Plasma Wayland. 

It just works(tm) under GNOME, see https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/735
Comment 1 Benn Snyder 2021-09-21 22:30:50 UTC
This used to work with kwin-5.21.5 but now it fails after kwin-5.22.5 update.

    $ xhost +SI:localuser:steam
    localuser:steam being added to access control list
    $ sudo -u steam glxinfo
    Password: 
    Error: unable to open display :0

glxinfo is just an example - all xwayland programs fail with a similar message.
Comment 2 Vlad Zahorodnii 2021-09-22 06:54:07 UTC
I think it doesn't work because the X11 socket (in /tmp/.X11-unix/) is not writable by other users.
Comment 3 Benn Snyder 2021-09-23 21:38:31 UTC
(In reply to Vlad Zahorodnii from comment #2)
> I think it doesn't work because the X11 socket (in /tmp/.X11-unix/) is not
> writable by other users.

Excellent, thank you!  Now I can start programs like this.

    xhost +SI:localuser:steam
    chgrp -R users /tmp/.X11-unix/*
    chmod -R g=u /tmp/.X11-unix/*
    sudo -u steam glxinfo

But still it would be great if this use case could work without such scripting.
Comment 4 Bug Janitor Service 2021-11-11 20:28:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1646
Comment 5 Vlad Zahorodnii 2021-11-12 09:02:53 UTC
Git commit 83a036e9d40475d5c07177bf2e8bba9bc0fd4aa5 by Vlad Zahorodnii, on behalf of Weng Xuetian.
Committed on 12/11/2021 at 09:02.
Pushed by vladz into branch 'master'.

Fix XWayland abstract socket address.

NUL-termination byte is not needed for abstract socket. This leads to
XWayland listening to a wrong address.

Confirmed with lsof.

M  +4    -5    src/xwl/lib/xwaylandsocket.cpp

https://invent.kde.org/plasma/kwin/commit/83a036e9d40475d5c07177bf2e8bba9bc0fd4aa5
Comment 6 Vlad Zahorodnii 2021-11-12 09:03:23 UTC
Git commit 5a9a3e96898bd29ccbf31d9ff92dfb80274ce265 by Vlad Zahorodnii, on behalf of Weng Xuetian.
Committed on 12/11/2021 at 09:03.
Pushed by vladz into branch 'Plasma/5.23'.

Fix XWayland abstract socket address.

NUL-termination byte is not needed for abstract socket. This leads to
XWayland listening to a wrong address.

Confirmed with lsof.


(cherry picked from commit 83a036e9d40475d5c07177bf2e8bba9bc0fd4aa5)

M  +4    -5    src/xwl/lib/xwaylandsocket.cpp

https://invent.kde.org/plasma/kwin/commit/5a9a3e96898bd29ccbf31d9ff92dfb80274ce265