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-25 13:34 Message: It is not possible to force one path vs the other without doing it globally (whole test run). This is because psych adds to_yaml methods to core classes and once they're in place, there is nothing we can (or should) do about it. I've added a check for ENV['TEST_SYCK'] so we can skip loading psych for the sake of testing against syck only. I have a full green test run on both syck (with lots of deprecation warnings) and psych. If you're not getting a clean test run via 'rake TEST_SYCK=1', we need to open a new ticket with details on your environment. ---------------------------------------------------------------------- Comment By: Scott Tadman (tadman) Date: 2011-05-24 19:40 Message: Ruby is switching to psych, so that's good news? https://github.com/ruby/ruby/commit/4eaf3d4a511611f0a81d2da23ffb72b7641507f3 Still, it should be possible to force the use of one path through the code for testing purposes. If you have branches, you need tests for both paths. This is presuming the secondary branch is actually required, as it's not clear why it needs such special handling. If I simply force the first branch I get a bunch of errors from failing tests that look like this: 7) Failure: test_build_indicies(TestGemIndexer) [/Users/tadman/git/rubygems/test/rubygems/test_gem_indexer.rb:80]: Expected [["a", Gem::Version.new("1"), "ruby"], ["a", Gem::Version.new("2"), "ruby"], ["a_evil", Gem::Version.new("9"), "ruby"], ["b", Gem::Version.new("2"), "ruby"], ["c", Gem::Version.new("1.2"), "ruby"], ["d", Gem::Version.new("2.0"), "ruby"], ["dep_x", Gem::Version.new("1"), "ruby"], ["pl", Gem::Version.new("1"), "i386-linux"], ["x", Gem::Version.new("1"), "ruby"]], not [["a", Gem::Version.new("1"), "ruby"], ["a", Gem::Version.new("2"), "ruby"], ["a_evil", Gem::Version.new("9"), "ruby"], ["b", Gem::Version.new("2"), "ruby"], ["c", Gem::Version.new("1.2"), "ruby"], ["d", Gem::Version.new("2.0"), "ruby"], ["dep_x", Gem::Version.new("1"), "ruby"], ["pl", Gem::Version.new("1"), "x86-linux"], ["x", Gem::Version.new("1"), "ruby"]]. I've tried to find the origin of this "i386-linux" -> "x86-linux" mapping, which apparently originates in the encode_with method of the same module, as it only manifests when using Syck on the first branch, not Syck on the second or Psych on the first. I'd rather see Syck go, it has a number of serious flaws that have never been properly addressed, but adding libyml as a dependency is going to be a hard sell for non-1.9.3 installs. ---------------------------------------------------------------------- Comment By: Erik Hollensbe (erikh) Date: 2011-05-24 11:48 Message: Ryan, I don't run with Psych and can (and do) routinely test this code path. -Erik ---------------------------------------------------------------------- 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