Public bug reported:
The python-xlib package does not appear to correctly use X11 cookies
from $XAUTHORITY under Ubuntu 18.04 (and possibly others).
GNOME3 appears to store the cookies in /run/user/$UID/gdm/Xauthority
(and set $XAUTHORITY to this value for the user), but gdm does not
appear to include a display number in the authorization entry; e.g.,
"xauth list" shows "HOSTNAME/unix:" instead of "HOSTNAME/unix:0" for the
entry. python-xlib is apparently unable to locate and use the cookie
without the display number being present.
This deficiency is typically masked by the presence of "si:localuser:"
entries in the xhost table; however, it is sometimes necessary to use
XAUTH rather than xhost (e.g., when using certain Tcl/Tk applications
which insist on the xhost table being empty for secure communication
through the X server).
To reproduce:
xhost -si:localuser:$USER
python -c 'from Xlib.display import Display; Display()'
This results in:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/djast/.local/lib/python2.7/site-packages/Xlib/display.py", line
89, in __init__
self.display = _BaseDisplay(display)
File "/home/djast/.local/lib/python2.7/site-packages/Xlib/display.py", line
71, in __init__
protocol_display.Display.__init__(self, *args, **keys)
File
"/home/djast/.local/lib/python2.7/site-packages/Xlib/protocol/display.py", line
166, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0": No protocol
specified
If the xauth entry is updated to include ":0", e.g., via
xauth add $DISPLAY $(xauth list $DISPLAY | cut -d: -f2- | tail -1)
then running "python -c 'from Xlib.display import Display; Display()'"
succeeds.
python3-xlib appears to have the same deficiency.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: python-xlib 0.20-3
ProcVersionSignature: Ubuntu 4.15.0-108.109-generic 4.15.18
Uname: Linux 4.15.0-108-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.15
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Jun 26 11:28:32 2020
Dependencies: python-six 1.11.0-2
InstallationDate: Installed on 2018-07-31 (695 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
PackageArchitecture: all
SourcePackage: python-xlib
UpgradeStatus: No upgrade log present (probably fresh install)
** Affects: python-xlib (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug bionic
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1885304
Title:
Python Xlib applications report 'Can't connect to display ":0": No
protocol specified' if XAUTH authentication is needed
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-xlib/+bug/1885304/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs