RubyGems 1.0.0 hack may be due to yaml_initialize not getting called
--------------------------------------------------------------------
Key: JRUBY-1768
URL: http://jira.codehaus.org/browse/JRUBY-1768
Project: JRuby
Issue Type: Bug
Reporter: Charles Oliver Nutter
Assignee: Thomas E Enebo
Fix For: JRuby 1.1
When I installed RubyGems 1.0.0 into JRuby trunk, I had to hack version.rb to
call to_ints on the target version object when performing comparisons:
{noformat}
def <=>(other)
return 1 unless other
@ints <=> other.to_ints
end
{noformat}
This is because the original code, which just called the attr accessor
other.ints, was getting a nil result. The ints attr is initialized here:
{noformat}
def normalize
@ints = build_array_from_version_string
return if @ints.length == 1
@ints.pop while @ints.last == 0
@ints = [0] if @ints.empty?
end
{noformat}
Which is called from here on the version attr setter:
{noformat}
def version=(version)
@version = version.to_s.strip
normalize
end
{noformat}
Which is called by all initialization entry points into the object:
{noformat}
def initialize(version)
raise ArgumentError, "Malformed version number string #{version}" unless
self.class.correct?(version)
self.version = version
end
...
def marshal_load(array)
self.version = array[0]
end
...
def yaml_initialize(tag, values)
self.version = values['version']
end
{noformat}
So the simplest conclusion here is that for some path to object initialization,
one of these entry points is not getting invoked. I confirmed briefly that
marshal_dump is getting called for unmarshaling, and initialize would be nearly
impossible to avoid calling for normal object instantiation. That leaves
yaml_initialize as the most likely candidate, and Ola mentioned there were
issues getting yaml_initialize to work in JRuby.
I do not want to leave the hack in place; RubyGems should "just work". We need
to figure out why @ints isn't getting initialized.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email