Bug #7760

"-\n2000-01-02 03:04:05".to_yaml raise ArgumentError

Added by Kazuhiro NISHIYAMA almost 3 years ago. Updated 12 months ago.

Assignee:Aaron Patterson
ruby -v:ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.0] Backport:


1.9.3's psych raises ArgumentError.
2.0.0's psych doesn't.

% ruby -v -r yaml -e '"-\n2000-01-02 03:04:05".to_yaml'
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.0]
/Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/scalar_scanner.rb:111:in utc': argument out of range (ArgumentError)
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/scalar_scanner.rb:111:in
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/scalar_scanner.rb:48:in tokenize'
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:242:in
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:103:in accept'
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb:67:in
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych.rb:242:in dump'
from /Users/kazu/.rbenv/versions/1.9.3-p374/lib/ruby/1.9.1/psych/core_ext.rb:14:in
from -e:1:in `'


#1 Updated by Yui NARUSE almost 3 years ago

  • Target version changed from 1.9.3 to next minor

#2 Updated by Zachary Scott over 2 years ago

I cannot reproduce this with trunk:

ruby -v -rpsych -e 'p "-\n2000-01-02 03:04:05".to_yaml'
ruby 2.1.0dev (2013-08-02 trunk 42318) [x86_64-darwin12.4.0]
"--- |-\n -\n 2000-01-02 03:04:05\n"

Try to update your installation of Psych?

#3 Updated by Hiroshi SHIBATA over 1 year ago

  • Status changed from Open to Feedback

It's already fixed in trunk, 2.1.0 and 2.0.0 HEAD revision.
Ruby 1.9 is only security maintenance phase.

I think this issue should be closed.

#4 Updated by Aaron Patterson 12 months ago

  • Status changed from Feedback to Closed

This was fixed, so I'm closing it.

Also available in: Atom PDF