Fork me on GitHub

Sunday, December 7, 2008

Almost fainted


I was trying to give a refresh to my own personal blog with a brand new SVN snapshot; it’s been a long since I updated with the last changes the FP installed there.

I almost fainted when I saw a fatal error in FlatIndex/BPlusTree coming up.

What. The. Hell.

I have to discuss the thesis in a few days, I’m supposed to be working on the presentation, in fact. You can imagine how I could feel.

A few swears later, it turns out that I was reading a signed int as unsigned and therefore everything went horribly wrong.

I was already picturing images of EPIC FAILure (O NOES ENDIAN-NESS!) but luckily I was able to track the issue down; FIX’D in your SVN.

Now, you may ask, how did this trivial bug make to slip in the lib?

Well, in my tests even though the code was trying to read an unsigned value, the unpack() command still returned a signed value.

I suppose it was a bug in the PHP version of my tests. True story.

Well, finally all went well.