#35 set default values, when there is no ~/.Xauthority


Recently slim doesn't create an ~/.Xauthority file by default, so the user is forced to do this on his/her own.
If not, e.g. gmixer is crashing...

Would it be possible to set reasonable default values, when there is no ~/.Xauthority file instead of crashing?

As a reference see:


  • Mike Grant

    Mike Grant - 2010-09-02

    Hmm, that's a tricky one - I'm not sure there is a sensible default as you (probably) need the cookie in order to connect. However, perhaps it's possible to get the cookie another way - if you run "xauth list" do you get something like:
    machine.domain/unix:0 MIT-MAGIC-COOKIE-1 2d3c0359e1744ca68d2388d68aa14c52

    If so, there's an old method to get the cookie using a system call to xauth that you could try. Edit Xlib/support/unix_connect.py and change the last line to "get_auth = old_get_auth". I've not tested it, but that should use the xauth list output instead of parsing ~/.Xauthority.

    If that works, let me know and maybe we can add that as a last-resort fallback if Xauthority parsing fails.

  • Thomas Spura

    Thomas Spura - 2010-09-04

    The old method seems to work!

    Quoting from the bugzilla url from above:
    "This appears to have solved the problem."

    This is the patch I applied (which should solve the problem completely), isn't it?
    $ cat python-xlib-0.15rc1-xauthority.patch
    Index: Xlib/support/unix_connect.py
    --- Xlib/support/unix_connect.py
    +++ Xlib/support/unix_connect.py 2010-09-03 00:49:15.066186229 +0200
    @@ -112,7 +112,11 @@
    family = xauth.FamilyLocal
    addr = socket.gethostname()

    - au = xauth.Xauthority()
    + try:
    + au = xauth.Xauthority()
    + except error.XauthError:
    + return old_get_auth(sock, dname, host, dno)
    while 1:
    return au.get_best_auth(family, addr, dno)


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks