Project

General

Profile

Bug #4342

YAML raises an exception while parsing certain regular expressions

Added by agrimm (Andrew Grimm) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-01-29 trunk 30720) [x86_64-darwin10.4.0]
Backport:
[ruby-core:34969]

Description

=begin
Roundtripping does not work for the regular expresion //n , and this appears to be distinct from Backport87 bug 1639.

irb -d
ruby-head :001 > require "yaml"
Exception NameError' at /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck/tag.rb:81 - methodyaml_as' not defined in Module
=> true
ruby-head :002 > Regexp.new('',0,'n')
=> //n
ruby-head :003 > YAML.dump(Regexp.new('',0,'n'))
=> "--- !ruby/regexp //n\n"
ruby-head :004 > YAML.load(YAML.dump(Regexp.new('',0,'n')))
Exception Syck::TypeError' at /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck/rubytypes.rb:283 - Invalid Regular expression: "//n"
Exception
Syck::TypeError' at /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/irb/workspace.rb:80 - Invalid Regular expression: "//n"
Syck::TypeError: Invalid Regular expression: "//n"
from /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck/rubytypes.rb:283:in yaml_new'
from /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck.rb:135:in
transfer'
from /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck.rb:135:in node_import'
from /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck.rb:135:in
load'
from /Users/agrimm/.rvm/rubies/ruby-head/lib/ruby/1.9.1/syck.rb:135:in load'
from (irb):4
from /Users/agrimm/.rvm/rubies/ruby-head/bin/irb:16:in
'
ruby-head :005 > # The following works, indicating it's distinct from backport87 bug 1639
ruby-head :006 > YAML.load(YAML.dump(Regexp.new('',0,'u')))
(irb):6: warning: encoding option is ignored - u
=> //
=end

History

#1

Updated by Anonymous over 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r30763.
Andrew, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/psych/lib/psych/visitors/to_ruby.rb: ARG_ENCODING_NONE regular expressions can round trip. [ruby-core:34969]
  • test/psych/test_yaml.rb: test for ARG_ENCODING_NONE regex
  • ext/sych/lib/syck/rubytypes.rb: ARG_ENCODING_NONE regular expressions can round trip.
  • test/syck/test_yaml.rb: test for ARG_ENCODING_NONE regex =end

Also available in: Atom PDF