Friday, January 11, 2008

The middle finger of .CFUserTextEncoding

Recently, I had a bad crash on my MacBook while it was downloading some torrents. When I came back, I had to use the power button to restart the machine, and after the reboot, some things were broken. First, Font Book contained no fonts. Second, LyX didn't run. Third, Atlantis (a MUD client) didn't run either.

The LyX error looked like this:
LyX: Creating directory
Same as entered returned
Failed to create directory. Exiting.


And Atlantis didn't give me any error message. So, after a long time fiddling around with directory permissions, changing my group from admin to user and chowning a bit, I noticed from a dtruss log of failed and successful (by simply running as another user with sudo) runs of the affected programs that the file ~/.CFUserTextEncoding was being accessed at some point.
So I had a quick look at this file in the failure (first) and success (...second) cases:
Macintosh:~ oisin$ more .CFUserTextEncoding
39:50
Macintosh:~ oisin$ more ../yunqing/.CFUserTextEncoding
../yunqing/.CFUserTextEncoding: Permission denied
Macintosh:~ oisin$ sudo more ../yunqing/.CFUserTextEncoding
0:0

Replacing mine with 0:0 and su'ing to myself to get a new shell, I was able to run LyX and Atlantis with no problems. So, I'm not sure what this means - maybe the crash wiped out an encoding method or wrote the wrong data to that file, and when applications read from .CFUserTextEncoding they tried to look for/save their settings in the wrong place.

Confusing, but at least there's a fix.

No comments:

Post a Comment