thoughts from brian samson

Kiln’s kilnauth.py crashes under python 2.4

We recently switched to using Mercurial hosted at Joel Spolsky’s Kiln. So far I love it. I think distributed source control is the way of the future and I’m all for it.

Anyway, Kiln provides a number of useful Mercurial plugins, one of which is called ‘kilnauth’ and helps by caching your http authentication cookies so you don’t have to enter your password a bunch of times. I was setting this up on our linux box, which only has python 2.4, and kilnauth was causing a crash when it tried to do an md5 hash. The fix is pretty easy. Near the top where they import the md5 library, change this line:

try:
    from hashlib import md5
except:
    # Python 2.4
    import md5

To this:

try:
    from hashlib import md5
except:
    # Python 2.4
    from md5 import md5

That’s it. Simple little typo that they probably just didn’t test.

And on the subject of passwords, if you are bothered that capistrano outputs your inline http authentication passwords to the console, you can install this gem I wrote, cap_password_filter, to fix that.

To help out with searching, I’m including the full stack trace of the error:

** unknown exception encountered, details follow
** report bug details to http://mercurial.selenic.com/bts/
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.5)
** Extensions loaded: kilnauth
Traceback (most recent call last):
  File "/usr/bin/hg", line 27, in ?
    mercurial.dispatch.run()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 30, in dispatch
    return _runcatch(u, args)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 47, in _runcatch
    return _dispatch(ui, args)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 466, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 336, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 517, in _runcommand
    return checkargs()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 471, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 465, in 
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File “/usr/lib/python2.4/site-packages/mercurial/util.py”, line 401, in check
    return func(*args, **kwargs)
  File “/usr/lib/python2.4/site-packages/mercurial/commands.py”, line 677, in clone
    branch=opts.get(’branch’))
  File “/usr/lib/python2.4/site-packages/mercurial/hg.py”, line 209, in clone
    src_repo = repository(ui, source)
  File “/usr/lib/python2.4/site-packages/mercurial/hg.py”, line 82, in repository
    repo = _lookup(path).instance(ui, path, create)
  File “/usr/lib/python2.4/site-packages/mercurial/httprepo.py”, line 271, in instance
    inst.between([(nullid, nullid)])
  File “/usr/lib/python2.4/site-packages/mercurial/httprepo.py”, line 190, in between
    d = self.do_read(”between”, pairs=n)
  File “/usr/lib/python2.4/site-packages/mercurial/httprepo.py”, line 134, in do_read
    fp = self.do_cmd(cmd, **args)
  File “/usr/lib/python2.4/site-packages/mercurial/httprepo.py”, line 85, in do_cmd
    resp = self.urlopener.open(req)
  File “/home/xxx/kilnauth.py”, line 145, in open
    cj = get_cookiejar(ui)
  File “/home/xxx/kilnauth.py”, line 66, in get_cookiejar
    cookie_path = os.path.join(cookie_path, md5(current_user).hexdigest())
  File “/usr/lib/python2.4/site-packages/mercurial/demandimport.py”, line 71, in __call__
    raise TypeError(”%s object is not callable” % repr(self))

The OS Hokey Pokey

So recently, my XP system fell victim to a spyware infection. I battled hard, but in the end I decided to just reformat, mostly because I hadn’t formatted in 6 months or so. So I decided to try the new Windows Vista Beta. It installed fine, looked pretty good, but one little problem: it didn’t recognize my network card. Bummer.

So I figured its time to retry LInux. I give linux a shot once a year or so as a desktop OS and I can usually put up with it for a few months and then something I need to do causes me to go back to windows. This time I tried Ubuntu. The install was very good, and with only one problem: again my network card didnt work. However unlike windows, you can do something about that.

This thread told me to enable dmfe and disable tulip, and then my ghetto davicom ethernet contoller worked perfectly. So far so good!

The one other thing to do was get my dual monitors working. I thought this would be tough, but it was very easy. The nVidia drivers are just a checkbox away using the ubuntu package manager, and then I configured X to use a nVidia thing called “TwinView” that is working very well. It emulates on X “Screen” using my two monitors. I’m thinking about changing it to use 2 Screens because TwinView seems to have a problem realizing that my LCD is my primary monitor and so I can only get fullscreen apps on my CRT :(

In conclusion, so far so good! I think I might be able to get away with linux for a lot longer this time. Nice to see the community making some updates, although clearly linux still doesn’t quite pass the “mother test.” But its getting close!

Now my music is up (xmms), AOL (gaim) works great, and my browser (firefox) acts the same as windows.