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

Category: other
Group: None
Status: Closed
Resolution: Rejected
Priority: 3
Submitted By: Scott Tadman (tadman)
Assigned to: Ryan Davis (zenspider)
Summary: RubyGems uses deprecated API: YAML.quick_emit

Initial Comment:
Running `rake test` on rubygems produces thousands of warnings about 
YAML.quick_emit being deprecated.

This was fixed by Tenderlove with a patch associated with the ticket at 
http://redmine.ruby-lang.org/issues/show/4163 so it should be easy to repair.

After examining the code it seems this warning may not be presented to people 
if they have warnings turned off, or if they're using a non-syck YAML engine so 
it may not have been observed by the build team.


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

>Comment By: Scott Tadman (tadman)
Date: 2011-05-24 14:02

Message:
This is what I'm seeing running tests on 1.9.2. I don't have Psych installed.

........../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in 
`to_yaml': YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
./Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
./Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
....../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in 
`to_yaml': YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
....../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in 
`to_yaml': YAML.quick_emit is deprecated
./Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
.........../Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in 
`to_yaml': YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated
/Users/tadman/git/rubygems/lib/rubygems/specification.rb:1898:in `to_yaml': 
YAML.quick_emit is deprecated

It goes on like that for another few thousand lines.

Output from irb:

    > YAML::ENGINE
     => #<YAML::EngineManager:0x000001008fc4f0 @yamler="syck"> 

This triggers the quick_emit branch in Gem::Specification#to_yaml:

  def to_yaml(opts = {}) # :nodoc:
    if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? then
      super.gsub(/ !!null \n/, " \n")
    else
      YAML.quick_emit object_id, opts do |out|
        out.map taguri, to_yaml_style do |map|
          encode_with map
        end
      end
    end
  end

Presumably if you have another YAML engine installed or loaded this will not 
trigger and you will not see the warnings. This branch should be 
exercised at least once during the tests.

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

Comment By: Ryan Davis (zenspider)
Date: 2011-05-23 20:59

Message:
ok... I've got a repro by forcing syck at the top of rubygems.rb and running 
the tests.

I've consulted with tenderlove on this and the only "solution" is to install 
libyaml and switch to psych on 1.9. There is no other way to emit custom yaml 
on syck other than using deprecated API. Sorry. :/

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

Comment By: Ryan Davis (zenspider)
Date: 2011-05-23 20:43

Message:
What version of ruby are you running?

I'm not seeing this at all on either 1.8.7 or 1.9.2.

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

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=575&aid=29217&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