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

open
nobody
None
5
2012-12-07
2010-09-02
Thomas Spura
No

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:
https://bugzilla.redhat.com/show_bug.cgi?id=552491

Discussion

  • 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:
    try:
    return au.get_best_auth(family, addr, dno)