Bugs item #29217, was opened at 2011-05-20 09: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: Ryan Davis (zenspider) Date: 2011-05-24 11:31 Message: So, we're in agreement that this situation sucks. ;) I can't _reliably_ test both paths of to_yaml because I can't guarantee that the runtime will have both engines (like you). We do have some tests for to_yaml: 3924 % ack def.test_to_yaml test test/rubygems/test_gem_specification.rb 929: def test_to_yaml 939: def test_to_yaml_fancy 950: def test_to_yaml_platform_empty_string 956: def test_to_yaml_platform_legacy 968: def test_to_yaml_platform_nil but as you can see, none of them are engine specific. As I said before, this is an unfortunate situation, but valid. Syck is going away (it's not even the default engine in 1.9.3) and there is no workaround for this code _in_syck_, so the deprecation warning is valid. I talked tenderlove into improving the message to tell you to install libyaml and switch to psych (which means doing nothing on 1.9.3 and adding a require in ruby < 1.9.3--already done in rubygems). ---------------------------------------------------------------------- Comment By: Scott Tadman (tadman) Date: 2011-05-24 11: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 17: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 17: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