Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
graaff opened this Issue · 6 comments

2 participants

@graaff

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
<"#Object:0xfb7248ea4">.

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
Owner

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

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.

@trans trans was assigned
@trans
Owner

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
@graaff

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
Owner

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|
  ...
end

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.

Thanks.

@graaff

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
Something went wrong with that request. Please try again.