Yade starts without graphical interface

Bug #1223348 reported by Alexander Eulitz [Eugen]
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Yade
Fix Released
Low
Unassigned

Bug Description

Today I stumbled upon a bug in the startup script of Yade[1]. In my eyes this bug won't affect a lot of people.

I created a new user User1 on our Yade-Server. This user will run yade via remote connection (from ubuntu 12.04 LTS using rdesktop).
(To be more precise the setup is that: windows XP 32 bit dektop computer -> VirtualBox virtual machine using Ubuntu 12.04 LTS 32bit -> Yade-Server)

Starting Yade-Daily as User1 ends up in the noGui Version of Yade. You can start Yade in this version using the -n argument at startup:
yade-daily -n

There is no error message or warning. You just wont be able to start the qtController or 3D View.
According to [1]l ines 233-250 this will happen, if gui is not part of "features". After calling features in yade this could be declined. Checking yade.runtime.hasDisplay gives False. So it was obvious that an error was raised during Xlib.display._BaseDisplay().
After starting a python console and importing the Xlib module, a call of Xlib.display._BaseDisplay() ends up in an error [2]
I simply created an empty .Xauthority file:
touch ~/.Xauthority

After this things worked as they were expected to.
Just for double checking: if you start a python console, import Xlib and call Xlib.display._BaseDisplay(), you'll get:
Xlib.xauth: warning, no xauthority details available
<Xlib.display._BaseDisplay instance at 0x7ff5761525a8>

I'm not sure whether this solution can somehow be implemented at the startup of yade. At least a Warning should be raised if graphics are disabled. The Xauthority thing is mentioned in the comments but the user should be informed, too.

--------------
[1]https://github.com/yade/trunk/blob/master/core/main/main.py.in
especially lines 233-250:
"## run userSession in a way corresponding to the features we use:
gui=None
yade.runtime.hasDisplay=False # this is the default initialized in the module, anyway
if 'qt4' in features: gui='qt4'
if opts.nogui: gui=None
if gui:
 import Xlib.display
 # PyQt4's QApplication does exit(1) if it is unable to connect to the display
 # we however want to handle this gracefully, therefore
 # we test the connection with bare xlib first, which merely raises DisplayError
 try:
  # contrary to display.Display, _BaseDisplay does not check for extensions and that avoids spurious message "Xlib.protocol.request.QueryExtension" (bug?)
  Xlib.display._BaseDisplay();
  yade.runtime.hasDisplay=True
 except:
  # usually Xlib.error.DisplayError, but there can be Xlib.error.XauthError etc as well
  # let's just pretend any exception means the display would not work
  gui=None
"

[2]
user1@ubuntu:~$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Xlib.display
>>> xlib.display._BaseDisplay()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'xlib' is not defined
>>> Xlib.display._BaseDisplay()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/Xlib/display.py", line 65, in __init__
    apply(protocol.display.Display.__init__, (self, ) + args, keys)
  File "/usr/lib/pymodules/python2.7/Xlib/protocol/display.py", line 52, in __init__
    name, host, displayno)
  File "/usr/lib/pymodules/python2.7/Xlib/support/connect.py", line 94, in get_auth
    return mod.get_auth(sock, dname, host, dno)
  File "/usr/lib/pymodules/python2.7/Xlib/support/unix_connect.py", line 117, in new_get_auth
    au = xauth.Xauthority()
  File "/usr/lib/pymodules/python2.7/Xlib/xauth.py", line 44, in __init__
    raise error.XauthError('~/.Xauthority: %s' % err)
Xlib.error.XauthError: ~/.Xauthority: [Errno 2] No such file or directory: '/home/felix/.Xauthority'

description: updated
Revision history for this message
Bruno Chareyre (bruno-chareyre) wrote :

Hi Alexander (or Eugen?)
Thanks for reporting.
I'm not expert, but it seems to me that your User1 has no graphical display, at all. Can he start any graphical application like firefox, for instance?
.Xauthority should be created automatically by the session manager [1]. This is a bug in the user account more than in Yade itself (which you confirm by showing the same problem with python alone). There is nothing that we could fix on Yade's side.

A warning could be returned, you are right. I just committed that.
I consider the bug fixed, feel free to reopen if you don't agree.

Bruno

[1] https://bbs.archlinux.org/viewtopic.php?id=13189

Changed in yade:
status: In Progress → Fix Committed
Changed in yade:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.