Bugs: Browse | Submit New | Admin

[#29163] Invalid specs resulting from incorrect syck time parsing

Date:
2011-05-04 23:14
Priority:
3
Submitted By:
Bruno Michel (nono)
Assigned To:
Evan Phoenix (evan)
Category:
`gem` commands (other)
State:
Closed
Summary:
Invalid specs resulting from incorrect syck time parsing

Detailed description
Hi,

I have the bug described on https://github.com/rubygems/rubygems/pull/57 with Ruby 1.9.2-p180 and Rubygems v1.8.0. If
I generate a gem with `gem build`, the `date` field in the metadata of the generated gem is:

date: 2011-05-04 00:00:00.000000000Z

If I push this gem on rubygems.org and try to install it remotely (same PC), this does not works:

ERROR:  While executing gem ... (NameError)
    uninitialized constant Psych::Syck

Add A Comment: Notepad

Please login


Followup

Message
Date: 2011-07-10 12:58
Sender: Aryk Grosz

Nevermind my last comment. I just noticed that it was in master.

Do you know when the next version of rubygems might get released?
I noticed those fixes weren't in 1.8.5. Is there a way to run
an edge version of rubygems?
Date: 2011-07-10 12:54
Sender: Aryk Grosz

Evan, were your fixes in 0f4067a still in the most current version
of RubyGems.

I was looking at 1.8.5 and don't see this.

I'm using the latest version of RubyGems and struggling with
this issue.
Date: 2011-06-22 16:59
Sender: Dan Peterson

Should the fix be extended to `marshal_dump` as well?

I'm running into a problem on our internal gems repo where built-gem
metadata is being uploaded with unquoted ='s. When `gem
generate_index` is run, the metadata is loaded which turns the
= into DefaultKey. That's then marshaled out as part of the quick
specs which breaks clients that try to load them.

Applying the same fix to `marshal_dump` let quick specs be generated
that didn't have DefaultKey refs in them even though the incoming
gem specs were broken.
Date: 2011-06-01 20:53
Sender: Bruno Michel

Oki, now I understand from where this DefaultKey come. Thanks
Date: 2011-06-01 20:45
Sender: Evan Phoenix

Yep. You can see the syck bug by running this code:

YAML.load "- - =\n  - 1\n"

You'll see that syck puts DefaultKey in there, which is just
plain wrong.
 
Date: 2011-06-01 20:42
Sender: Ryan Davis

The problem is that psych will generate a perfectly valid string
that starts with an unquoted '='. Syck has a bug parsing that
and winds up using DefaultKey.
Date: 2011-06-01 19:13
Sender: Bruno Michel

Thanks for the explanation.

The gem was regenerated with a Ruby 1.8 and a new version
was pushed. If I want to build the next version with Ruby
1.9, how can I can be sure the new gem don't have a
YAML::Syck::DefaultKey?
Date: 2011-06-01 18:09
Sender: Evan Phoenix

I've fixed this by having the DefaultKey class always available
and having Requirement fix up any reference to it.

Fixed in github:0f4067a
Date: 2011-06-01 16:16
Sender: Evan Phoenix

This is because html_spellchecker has an instance of
YAML::Syck::DefaultKey in its gemspec.

These should not be in gemspecs and the gem needs to be regenerated.
I'm looking into a way to mitigate this in the mean time.
Date: 2011-05-24 10:20
Sender: Ryan Davis

I think it is your cache... That URL looks OK via:

    curl http://gems:Nasom4@gems.af83.com/specs.4.8.gz | gunzip
-dc | ruby -Ilib -rubygems -e 'p Marshal.load $stdin.read'
Date: 2011-05-24 10:12
Sender: Ryan Davis

Bruno, this installs fine for me as you can see below... From
your output, I suspect you might have a bad source in your list.
Specifically "gems.af83.com" looks like it might be
bad for you. Can you do `gem sources -c` to ensure that your
sources are default and your caches are cleared and try again
to verify?

    % gem i -i xxx html_spellchecker --version=0.1.1 -V
--backtrace
    GET http://rubygems.org/specs.4.8.gz
    302 Found
    GET http://production.s3.rubygems.org/specs.4.8.gz
    200 OK
    GET http://rubygems.org/quick/Marshal.4.8/html_spellchecker-0
.1.1.gemspec.rz
    ... and so on to completion ...
Date: 2011-05-24 09:43
Sender: Bruno Michel

Hi,

for example:

~% gem install html_spellchecker --version=0.1.1 -V --backtrace
GET http://rubygems.org/specs.4.8.gz
302 Found
GET http://production.s3.rubygems.org/specs.4.8.gz
304 Not Modified
GET http://gems:Nasom4@gems.af83.com/specs.4.8.gz
200 OK
ERROR:  While executing gem ... (NameError)
    uninitialized constant Psych::Syck
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/specification.rb:640:in `load'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/specification.rb:640:in `_load'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/spec_fetcher.rb:134:in `load'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/spec_fetcher.rb:134:in `fetch_spec'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/spec_fetcher.rb:95:in `block in fetch_with_errors'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/spec_fetcher.rb:94:in `map'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/spec_fetcher.rb:94:in `fetch_with_errors'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/dependency_installer.rb:110:in `find_gems_with_sources'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/dependency_installer.rb:228:in
`find_spec_by_name_and_version'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/dependency_installer.rb:259:in `install'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/commands/install_command.rb:121:in `block in execute'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/commands/install_command.rb:115:in `each'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/commands/install_command.rb:115:in `execute'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/command.rb:278:in `invoke'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/command_manager.rb:147:in `process_args'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/command_manager.rb:117:in `run'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/
rubygems/gem_runner.rb:65:in `run'
	/home/nono/.rvm/rubies/ruby-1.9.2-p180/bin/gem:21:in
`<main>'
zsh: exit 1
~% gem -v
1.8.3
Date: 2011-05-24 00:38
Sender: Ryan Davis

I need a full backtrace and the gem name+version to properly
investigate.

Your error doesn't jive with the date problem. (If I'm remembering
the error correctly).

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2011-06-01 20:532011-06-01 20:53nono
close_date2011-06-01 20:452011-06-01 20:45evan
resolution_idNone2011-06-01 20:42zenspider
close_date2011-06-01 20:422011-06-01 20:42zenspider
close_date2011-06-01 19:132011-06-01 19:13nono
close_date2011-06-01 18:092011-06-01 18:09evan
assigned_tozenspider2011-06-01 18:09evan
status_idOpen2011-06-01 18:09evan
assigned_tonone2011-05-24 00:38zenspider