object_hexid is broken on 32 bit arches with ruby 1.8.7. #28

graaff opened this Issue Nov 8, 2010 · 6 comments


None yet
2 participants

graaff commented Nov 8, 2010

ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]

irb(main):001:0> "0x%x" % (Object.new.id << 1)
=> "0x..fb741b4e8"
Note the two dots that should not be there and don't match the output of o.inspect.

This was also broken in facets 2.8.4:

  1. Failure:
    test_object_hexid(TCKernel) [./test/core/kernel/test_object_hexid.rb:8]:
    <"#Object:0xb7248ea4"> expected but was

In the implementation of this version there is a distinction between RUBY_VERSION < 1.8.7, but this distinction is really between 32bit and 64bit arches.


trans commented Jan 24, 2011

Ah, that's why I could never get consistent results form this method.

How do the object_id's differ under these two architectures?

graaff commented Jan 24, 2011

Both formats are described in lib/core/facets/kernel/object_hexid.rb

The format described by RUBY_VERSION < "1.8.7" is for 32bit, the other for 64bit.

@ghost ghost assigned trans Jul 17, 2011


trans commented Jul 17, 2011

Okay, this fix was in 2.9.1. I hope it is finally right. I've been f*ing with that method for way too long and I wish Matz would just include it in Ruby proper as I RCR'd years ago.

@trans trans closed this Jul 17, 2011

graaff commented Jul 18, 2011

I haven't been able to test 2.9.1 yet since it now uses lemon and that clashes with sqlite-2.x which also installs a binary called lemon. Once that is resolved I'll have another look at it. In any case thanks for fixing this!


trans commented Jul 18, 2011

Of course it does ;-/

Actually I'm pretty surprised to see they maintain their own parser just so they can parse SQL. Yacc and Bison might not be ideal but seems like a lot of extra trouble to roll your own.

In any case, name clashes SUCK. So I am attacking the problem two-fold.

I reworked Lemon's cli so there are now three commands: lemon-test, lemon-cov and lemon-gen. That should avoid bin clash. I am not happy about it, but what are you going to do?

I've also added a rake task.

require 'lemon/rake'

Lemon::Rake::TestTask.new do |t|

These changes will go out with the next release.

The big thing I am pondering right now though is whether to move forward with the unit do test do ... nested design. My gut feeling says it's the way forward, but I hesitate and could use some feedback.


graaff commented Jul 19, 2011

Thanks for the changes in the command names. My approach for Gentoo was to block on sqlite-2.x, but even though that is now obsoleted by sqlite-3.x it finds itself in many places on my system so it wasn't particularly easy. Having non-clashing command names makes things a lot easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment