Bug #4301
closedOff-by-one line number in Psych parse error
Description
=begin
For the following yaml:
based on "SGML/XML character entity reference" at http://www.bitjungle.com/isoent/
#DOUBLE LOW-9 QUOTATION MARK
#requires fontenc:T1
ldquor: ,,
Psych produces the following error:
/Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 5 column 9 (Psych::SyntaxError)
The error is at line 6, not line 5.
=end
Updated by Anonymous almost 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r30628.
Charles, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ext/psych/parser.c (parse): fixing off-by-one error on line numbers
in parse exceptions. [ruby-core:34690] - test/psych/test_parser.rb: test for error
=end
Updated by headius (Charles Nutter) almost 14 years ago
=begin
Hmm, I think there's more to this, and it could certainly be a bug in libyaml. The following version has the correct line number, without your patch:
~ ➔ ruby -rpsych -ryaml -e 'YAML.parse("---\nldquor: ,,")'/Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in parse': couldn't parse YAML at line 1 column 9 (Psych::SyntaxError) from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in
parse_stream'
from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:in parse' from -e:1:in
'
So there's something about the yaml I posted in the bug description that's special
=end
Updated by tenderlovemaking (Aaron Patterson) almost 14 years ago
=begin
On Sat, Jan 22, 2011 at 05:23:35PM +0900, Charles Nutter wrote:
Issue #4301 has been updated by Charles Nutter.
Hmm, I think there's more to this, and it could certainly be a bug in libyaml. The following version has the correct line number, without your patch:
~ ➔ ruby -rpsych -ryaml -e 'YAML.parse("---\nldquor: ,,")'/Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in
parse': couldn't parse YAML at line 1 column 9 (Psych::SyntaxError) from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in
parse_stream'
from /Users/headius/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:119:inparse' from -e:1:in
'So there's something about the yaml I posted in the bug description that's special
You're right. I'm going to revert this patch and reopen the ticket
until I figure out what's wrong. This definitely looks like a libyaml
problem. :-(
--
Aaron Patterson
http://tenderlovemaking.com/
Attachment: (unnamed)
=end
Updated by tenderlovemaking (Aaron Patterson) almost 14 years ago
- Status changed from Closed to Open
- Assignee set to tenderlovemaking (Aaron Patterson)
=begin
Reopening as this seems like a bug in libyaml.
=end
Updated by headius (Charles Nutter) almost 14 years ago
=begin
FYI, 1.8/syck parses the yaml shown here, but libyaml (and SnakeYAML) do not (correctly). Ran into it because it's in a file that ships with RedCar:
Originally thought it was a bug in SnakeYAML:
http://code.google.com/p/snakeyaml/issues/detail?id=105&can=1
Just wanted to make it clear the yaml shown here does appear to be "correctly invalid".
=end
Updated by usa (Usaku NAKAMURA) almost 14 years ago
- Status changed from Open to Assigned
=begin
=end
Updated by ko1 (Koichi Sasada) over 13 years ago
How about it?
Updated by nahi (Hiroshi Nakamura) over 13 years ago
- Target version set to 1.9.3
Updated by kosaki (Motohiro KOSAKI) over 13 years ago
- Category set to lib
- Target version changed from 1.9.3 to 2.0.0
I wonder why this issue is not 3rd party issue. Anyway this is not 1.9.3 material.
Updated by tenderlovemaking (Aaron Patterson) over 13 years ago
- Status changed from Assigned to Third Party's Issue
Yes, this should be third party issue.