April 5, 2006

This cost me a lot of time

As I mentioned previously, I recently upgraded my blogging software to Movable Type 3.2. After the upgrade, I found that I could no longer use the most-excellent MarsEdit to post to my blog.

A quick Google pointed out this helpful blog post, which said to set an "API Password", and all would be well.

Well, I did that, and things weren't well. Things haven't been well for days. So this evening, I finally sat down with "print STDERR" and figured out the problem. As it turns out, there is a bug in Movable Type (in my opinion). In the file 'cgi-bin/mt/lib/MT/XMLRPCServer.pm', there is this function (right at the top of the file):

sub mt_new {
    my $cfg = $ENV{MOD_PERL} ?
        Apache->request->dir_config('MTConfig') :
        $MT::XMLRPCServer::MT_DIR . '/mt.cfg';
    my $mt = MT->new( Config => $cfg )
        or die MT::XMLRPCServer::_fault(MT->errstr);
    $mt;
}
The bug is in the 3rd line of the function. In Movable Type 3.2, the name of the configuration file was changed from 'mt.cfg' to 'mt-config.cgi'. Unfortunately, this code still references the old filename. Normally, this isn't a problem, because you will have one file or the other. If the 'mt.cfg' file doesn't exist, some other part of MT will "do the right thing" and find your configuration file anyway.

However, I did an upgrade from a really old version of Movable Type. Thus, I had both the old 'mt.cfg' and 'mt-config.cgi' files in my 'mt' directory, and of course the old file had an invalid configuration, which was causing the above code to fail spectacularly. The fix is to either change the third line of code to look like this:

        $MT::XMLRPCServer::MT_DIR . '/mt-config.cgi';
Or, to get ride of the old 'mt.cfg' file (which is the route that I took). What really stinks about this whole episode, is that the logging/debugging facilities in MT appear to be really poor. This code was failing in an odd way, and it didn't leave any trail for me to follow in order to figure out what was going on.

-Andy.

Technorati Tags: , Posted by andyr at April 5, 2006 1:30 AM

Comments

After all this and the remaining issues to bring our blogs back to what they had once been, what are your thoughts on just asking for a refund, jumping ship and moving everything to wordpress.com. They can import the whole thing from a MT export.

Posted by: Mark at April 5, 2006 7:17 AM