Sunday, September 13, 2009

Emacs patches to build on Snow Leopard

I've been tinkering with the Emacs 23.1 code lately, trying to get it to compile on Snow Leopard, and get --daemon mode working on Mac OS X as well. I'm posting my patches to github as I work on it. I'm a bit of a git noob, so I'm not certain how (or even if) I could make a public repo on github of my branch, containing just my branch changes, and derive from git://git.savannah.gnu.org/emacs.git for the bulk of the data. That would be ideal, rather than maintaining a repo of patches. Also, even though the patch does get Emacs to compile, there are some obvious issues with it, so it's not ready for production use. First, font heights are not being calculated correctly. Second, there's very obvious lag when first starting up the window, which I must have added (as the 32 bit 23.1 binary doesn't have that problem).

Saturday, September 12, 2009

Snow Leopard and Time Machine over NFS

Ok, admittedly, I muck around with my systems more than strictly necessary (those that know me are guffawing at how much I'm understating this tendency), but I was having some issues getting Snow Leopard's Time Machine to continue backing up to my OpenSolaris file server over an NFS mount. My first problem was that I had somehow lost my NFS config on the OpenSolaris box. May have been due to a recent zpool upgrade, or due to the fact that I had recently completely destroyed and re-created that pool. In any case, I hadn't noticed this for a while because my NFS mounts were still working as expected for my average usage. After recreating the NFS share info (including the ability for root users on my MBP to be mapped as such on my file server), Time Machine got a bit further along. But now, it seemed to be complaining that it didn't have enough room on the backup drive. I hastily destroyed the old sparsebundle thinking that it a fresh start with a new image would work fine. When trying to backup with no sparsebundle available on the server, it gave the expected error due to being unable to create a sparsebundle directly on an NFS share. I still don't know why that's the case, but I remembered doing the same the previous time I set it up, and just created a sparsebundle locally then copied it to the server.
sudo hdiutil create -size 200g -type SPARSEBUNDLE -nospotlight -volname "Time Machine" -fs "Case-sensitive Journaled HFS+" -verbose /tmp/MACHINENAME.sparsebundle
Unfortunately, now when it tried to connect, I still saw TM attempting to create a new bundle. Not sure why, I decided to poke around backupd with dtrace for a bit to see what it was doing on the file system.

#!/usr/sbin/dtrace -s
syscall::open:entry
/execname=="backupd"/
{
 printf("UID %d: Opening file: %s.\n", uid, copyinstr(arg0));
}

syscall::open:return
/execname=="backupd"/
{
 printf("UID %d: Opening file returned: %d.\n", uid, arg0);
}

Turns out, TM was trying to read a file called com.apple.TimeMachine.MachineID.plist from within the sparsebundle directory (not the mounted image, just the directory). Some searching for that file name brought me to this page where they had the following as the suggested content for that file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>com.apple.backupd.HostUUID</key>
 <string>YOURUUIDHERE</string>
</dict>
</plist>
After dutifully replacing YOURUUIDHERE with my machine's UUID (pulled from System Profiler -> Hardware), Time Machine finally mounted my sparsebundle as requested and started the backup.

Tuesday, September 1, 2009

Highlights and Lowlights of Snow Leopard

I've had a few days to play around with Snow Leopard now, so I thought I'd just note a few of my favorite bits and a few nits I'd like to pick. The Good:
  • Four finger gesture support on my early 2008 MBP. I love this, and find myself already using it all the time for running Expose.
  • Improved services and creating services with Automator. About 20 minutes after I had Snow Leopard installed, I had an Automator workflow added to the services menu to open the selected file or folder in Emacs (still haven't finished debugging the --daemon mode on OS X yet though).
  • Hiding applications to their app icon, rather than a separate slot in the Dock. It used to drive me a bit crazy that when I clicked a doc icon for a hidden app, the app itself wouldn't pop back into view, and instead I'd have to find the minimized window. No more.
  • Dock Expose. I also find myself using this quite often to select a given window of an app.
The Bad:
  • Doesn't boot 64 bit by default. Wasn't this supposed to be one of the big selling points of Snow Leopard? Why do I have to hold magic keys during boot or update a plist to get this enabled?
  • Once I've booted into a 64 bit kernel, I'm having issues with both VMWare Fusion and VirtualBox. Fusion simply refused to start. VirtualBox attempted to start, but caused a kernel panic.