Skip Menu |

This queue is for tickets about the YAML-Syck CPAN distribution.

Report information
The Basics
Id: 19313
Status: resolved
Priority: 0/
Queue: YAML-Syck

People
Owner: TODDR [...] cpan.org
Requestors: kevinj [...] activestate.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 0.60



Subject: Incorrect parsing of newlines
perl -MJSON::Syck -le 'print JSON::Syck::Dump({a => "hello\nworld\n"})' This should produce: {"a":"hello\nworld\n"} but instead produces: {"a":"hello\n\ world\n"}
Show quoted text
> {"a":"hello\n\ > > world\n"}
Ah, you can't see it very well in this font, but the newline is replaced by \n followed by a literal newline and two spaces
Here's my patch which fixes this bug... It doesn't break any unit tests in this package, YAML::Syck, nor why's libsyck
==== //depot/main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/emitter.c#1 - /usr/home/kevinj/depot/main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/emitter.c ==== Index: main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/emitter.c --- main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/emitter.c.~1~ Fri May 26 13:32:08 2006 +++ main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/emitter.c Fri May 26 13:32:08 2006 @@ -871,7 +871,7 @@ case '\n': end = mark + 1; syck_emitter_write( e, "\\n", 2 ); - do_indent = 2; + //do_indent = 2; start = mark + 1; if ( start < str + len && ( *start == ' ' || *start == '\n' ) ) { do_indent = 0; ==== //depot/main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/t/01_json.t#1 - /usr/home/kevinj/depot/main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/t/01_json.t ==== Index: main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/t/01_json.t --- main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/t/01_json.t.~1~ Fri May 26 13:32:08 2006 +++ main/Appliance/apps/projects/goodfellow/cpan-packages/cpan-packages/JSON-Syck/t/01_json.t Fri May 26 13:32:08 2006 @@ -31,6 +31,7 @@ '["",null]', '{"foo":""}', '["\"://\""]', + '{"hw":"Hello\nWorld\n"}', ); plan tests => scalar @tests * (1 + $HAS_JSON) * 2; End of Patch.
Based on a bisect, this appears to have been resolved in 0.60