Trace/BPT trap: 5 when accessing SystemVersion.plist in Mavericks

Posted by on Nov 9, 2013 in Geekery, Mac, OSX, programming | No Comments

If you’re reading this blog entry because you’re a subscriber, I’d stop now and skip this one. Unless you’re extremely geeky. This is more of a public service announcement to anyone who’s installed OSX 10.9 and Xcode 5, and finds themselves oddly unable to compile even the simplest program using the command-line tools, from gcc to clang.

Long story short: if you find yourself seeing traps (Trace/BPT trap: 5) and segmentation faults from clang or gcc, and *especially* if you track it down to an __open call dying very early in the process, it’s possible you’ve run into the same problem I did: a problem accessing /System/Library/CoreServices/SystemVersion.plist.

Here’s the situation I found myself in:

Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
Trace/BPT trap: 5

Yup. Instead of seeing the content of SystemVersion.plist, like you’d expect, I got an instant trap from the OS, and no file content. Strangely, other users — root and normal test users — could read the file just fine.

The file permissions were fine, and if I moved the file to a different name, I could see it. If I put a new file with readable-by-everyone permissions in the place of SystemVersion.plist, it died with the same BPT trap error.

After a fair bit of detective work, and some sterling help from Apple’s compiler fronted team (thanks, Ted!), and following some confirmation and investigation by those nice people at Rogue Amoeba, I tracked this down to an errant, development version of their InstantOn extension, used by their Airfoil product range, among others:

Matt-Gibsons-iMac:~ matt$ kextstat | grep rogueamoeba
   68    0 0xffffff7f81657000 0x3000     0x3000     com.rogueamoeba.InstantOn (6.0.4) 
  113    0 0xffffff7f82276000 0x26000    0x26000    com.rogueamoeba.InstantOnCore (6.0.4) 
Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
Trace/BPT trap: 5
Matt-Gibsons-iMac:tmp matt$ sudo kextunload -b com.rogueamoeba.InstantOn
Matt-Gibsons-iMac:tmp matt$ cat /System/Library/CoreServices/SystemVersion.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

I have *no* idea where this old version of the InstantOn extension came from — as far as I can tell, having upgraded to a newer version with the help of Rogue Amoeba’s support team, the latest version of InstantOn doesn’t even use a kernel extension, let alone one that causes problems with reading SystemVersion.plist. And it wasn’t causing a problem with previous versions of OS X. So I think it’s safe to say that this is a rare (and almost certainly self-inflicted) problem.

But, given that it took me a few days, a lot of unproductive Googling, and help from Apple and Rogue Amoeba to find, I figured I’d post about it, just in case anyone else was in the same boat and might come across this in a web search. If *you’re* having trouble with clang or other compiler tools on Mavericks, it might be worth seeing if the user account with the problem can read /System/Library/CoreServices/SystemVersion.plist, and if not, check for a rogue version of Rogue Amoeba’s InstantOn…

If so, installing the latest version of Airfoil, or whatever product it is you’re using, then updating the InstantOn component, and then rebooting, might well fix it. And you can double-check in advance with:

sudo kextunload -b com.rogueamoeba.InstantOn

…which immediately fixed the problem for me, at least until the next reboot.

I’ll finish with the stack trace from the clang failure I was seeing, for the purposes of getting some relevant keywords into search engines:

« Instagram | Favourite Photo of the Month 2013 »