Previous Entry Share Next Entry
12:18 pm, 20 Jan 06

ruby sqlite3 = :(

To better support this offline project, I rewrote LogJam's journal export in Ruby. (It's gotta be like 10% of the length of the original code, mostly due to blocks and the GC.)

Unfortunately, libsqlite3-ruby 1.1.0, the latest available, is buggy. A deterministic program dies with a variety of errors when ran multiple times in a row:
/usr/lib/ruby/1.8/sqlite3/driver/native/driver.rb:169:in `sqlite3_step': undefined method `call' for 21:Fixnum (NoMethodError)

/usr/lib/ruby/1.8/sqlite3/driver/native/driver.rb:169:in `sqlite3_step': undefined method `call' for true:TrueClass (NoMethodError)

/usr/lib/ruby/1.8/sqlite3/driver/native/driver.rb:169: [BUG] Segmentation fault
ruby 1.8.4 (2005-12-16) [i486-linux]

Looks like a memory bug. The probably either forgot to register something with the GC or just used something uninitialized. In any case, I need to figure out what approach will be the least painful.

(Update: using DBI's sqlite3 wrapper fixed it, for some reason or another...)