Mork And Casey Anthony

Jamie Zawinski linked to a very interesting blog post about the forensics problem in the recent Casey Anthony trial. To summarize, she was using an older version of Firefox, which stores its history in a Mork DB. For those not familiar with Mozilla internals, Mork is (I’m quoting JWZ here):

…the single most braindamaged file format that I have ever seen in my nineteen year career”.

That bug was actually one of two times where I brushed with Mork, that time learning, and another time shortly afterwards where I learned first hand how impossible it really is to work with as part of a hack I was trying to build and later abandoned. Perhaps it was my experience at the time that just made it impossible, perhaps it really was Mork.

Coincidentally Mork is now completely dead. I suspect the last bits were actually Thunderbird who used Mork pretty extensively as Mail really is a giant database of messages, and another giant database of addresses that you interact with. I’m speculating as I haven’t been following that closely.

Long live SQLite. I still find you slightly odd at times, especially your locking which seems foreign to me, however I just think of Mork and all of a sudden, it’s OK.

The most amusing, interesting and strange comment header I’ve ever found in a script goes to mork.pl for this:

##############################################################################
#
# And Now, The Ugly Truth Laid Bare:
#
#   In Netscape Navigator 1.0 through 4.0, the history.db file was just a
#   Berkeley DBM file.  You could trivially bind to it from Perl, and
#   pull out the URLs and last-access time.  In Mozilla, this has been
#   replaced with a "Mork" database for which no tools exist.
#
#   Let me make it clear that McCusker is a complete barking lunatic.
#   This is just about the stupidest file format I’ve ever seen.
#
#       http://www.mozilla.org/mailnews/arch/mork/primer.txt
#       http://jwz.livejournal.com/312657.html
#       http://www.jwz.org/doc/mailsum.html
#       http://bugzilla.mozilla.org/show_bug.cgi?id=241438
#
#   In brief, let’s count its sins:
#
#     – Two different numerical namespaces that overlap.
#
#     – It can’t decide what kind of character-quoting syntax to use:
#       Backslash?  Hex encoding with dollar-sign?
#
#     – C++ line comments are allowed sometimes, but sometimes // is just
#       a pair of characters in a URL.
#
#     – It goes to all this serious compression effort (two different
#       string-interning hash tables) and then writes out Unicode strings
#       without using UTF-8: writes out the unpacked wchar_t characters!
#
#     – Worse, it hex-encodes each wchar_t with a 3-byte encoding,
#       meaning the file size will be 3x or 6x (depending on whether
#       whchar_t is 2 bytes or 4 bytes.)
#
#     – It masquerades as a "textual" file format when in fact it’s just
#       another binary-blob file, except that it represents all its magic
#       numbers in ASCII.  It’s not human-readable, it’s not hand-editable,
#       so the only benefit there is to the fact that it uses short lines
#       and doesn’t use binary characters is that it makes the file bigger.
#       Oh wait, my mistake, that isn’t actually a benefit at all.
#
# Pure comedy.
#
##############################################################################

The title of this blog post is in no way a play on Mork & Mindy ;-)

3 thoughts on “Mork And Casey Anthony

  1. Actually, Thunderbird still uses mork super-lots in exactly the places you cite. But that’s the comm-central tree, not the mozilla-central tree, so the tweet is (probably) technically accurate if interpret Mozilla as the tree and not the giant project.

  2. As Andrew says, Mork is not completely dead yet. It was written for address books originally, and it’s firmly in grasp of them still. I never was sure why it had been adopted for history as well, and thankfully it’s gone there. But it’s only completely dead in Firefox – in Thunderbird and SeaMonkey it still lives on for address books (and even some other smaller parts of mailnews).

  3. @Robert Kaiser: My understanding is prior to Mork, Berkeley DB was used. However the Sleepycat license wasn’t going to workout very well with Mozilla being open sourced under a tri-license scheme. Hence the switch to something that was DB like, and open in nature without patents. For some reason, Mork was chosen.

    That’s the folklore I heard either on IRC or a forum late one night years ago. I can’t say for certain that’s canon or just a legend. I suspect those who know have long moved on to other projects.

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>