Bugs item #29181, was opened at 2011-05-07 06:42
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29181&group_id=126

Category: other
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Luis Lavena (luislavena)
Assigned to: Ryan Davis (zenspider)
Summary: RubyGems date spec field causing issues

Initial Comment:
A new gem just released by one of the RubyInstaller contributors generated this:

http://groups.google.com/group/rubyinstaller/msg/6a0b05d51811f5bc

A simple gem, generated with Ruby 1.9.2 causes date to be generated incorrectly:

Ruby 1.9.2 with RubyGems 1.8.1
date: 2011-05-07 00:00:00.000000000Z

Ruby 1.8.7 with RubyGems 1.8.1:
date: 2011-05-07 00:00:00 Z

Installing that gem causes this:

Invalid gemspec in 
[C:/Users/Luis/.gem/ruby/x86-mingw32/1.8/specifications/autotest-snarl-0.0.2.gemspec]:
 invalid date format in specification: "2011-05-07 00:00:00.000000000Z"
C:/Users/Luis/Tools/ruby/ruby-1.8.7-p334-i386-mingw32/lib/ruby/site_ruby/1.8/rubygems/specification.rb:277:in
 `_resort!': undefined method `name' for nil:NilClass (NoMethodError)

Not during installation but later in the process.

You can reproduce this using my simple gem here:

https://github.com/luislavena/autotest-snarl

I don't use anything that is not RubyGems and Rake to generate it (even use 
Gem::PackageTask)


----------------------------------------------------------------------

Comment By: Alex Chaffee (alexch)
Date: 2011-05-18 16:38

Message:
Looks like this might fix it: specification:974

Change 

              if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
to

              if /\A(\d{4})-(\d{2})-(\d{2})\b/ =~ date then

(unit test notwithstanding, of course...)

Unfortunately it won't change it for earlier versions of Rubygems. For that 
it'd be necessary to change the output... maybe a quick hack like running gsub 
on the yaml output from builder.rb would suffice.


----------------------------------------------------------------------

Comment By: Alex Chaffee (alexch)
Date: 2011-05-18 15:57

Message:
Confirmed: Building the gem with 1.9.2p180 makes a metadata field with a 
different date format than building the gem with 1.9.2p0. And that new format 
is unreadable by older versions of Ruby. I think it's that they added 
fractional seconds to the time, and the poor old date parser breaks when it 
hits ".0000000".

It looks like Gem is just using "to_yaml" to turn the spec into the metadata 
file (builder.rb:79), so this isn't something that can be fixed with a simple 
strftime format tweak.

See also bug #29202

----------------------------------------------------------------------

Comment By: Alex Chaffee (alexch)
Date: 2011-05-18 15:25

Message:
Verified on Ruby 1.9.2p180. This seems to have happened sometime between 
1.9.2-p0 and 1.9.2-p180, but I haven't yet done the regression to confirm. I 
know 1.8.7 works OK. 

To summarize: using MRI 1.9.2p180 to generate a gem results in an invalid date 
format. 

Workaround: use an older version or Ruby when *building* the gem. And do "gem 
specification pkg/foo-1.2.3.gem | grep date" to verify that your date is in the 
proper format before pushing to gemcutter.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29181&group_id=126
_______________________________________________
Rubygems-developers mailing list
http://rubyforge.org/projects/rubygems
Rubygems-developers@rubyforge.org
http://rubyforge.org/mailman/listinfo/rubygems-developers

Reply via email to