Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 35319
Status: open
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: jasonk@cpan.org (no email address)
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.66
Fixed in: (no value)



Subject: Can't roundtrip a multiline scalar that starts with whitespace...
Download (untitled) / with headers
text/plain 386b
This test script shows an example of a very simple multiline scalar that YAML cannot round-trip. It loses one leading space on it's way out. use Test::More tests => 3; use YAML qw( Dump Load ); my $in = " FOO\nBAR BAZ\n"; # ^^ 2 spaces ok( my $yaml = Dump( $in ), "Dump successful" ); ok( my $out = Load( $yaml ), "Load successful" ); is( $out, $in, "Roundtrip successful" );
Download (untitled) / with headers
text/plain 680b
Sorry, meant to include this as well... t/yaml-bug-1......1/9 # Failed test 'Roundtrip successful' # at t/yaml-bug-1.t line 10. # got: ' FOO # BAR BAZ # ' # expected: ' FOO # BAR BAZ # ' # Looks like you planned 9 tests but only ran 3. # Looks like you failed 1 test of 3 run. t/yaml-bug-1...... Dubious, test returned 1 (wstat 256, 0x100) Failed 7/9 subtests Test Summary Report ------------------- t/yaml-bug-1.t (Wstat: 256 Tests: 3 Failed: 1) Failed test: 3 Non-zero exit status: 1 Parse errors: Bad plan. You planned 9 tests but ran 3. Files=1, Tests=3, 1 wallclock secs ( 0.01 usr 0.00 sys + 0.10 cusr 0.01 csys = 0.12 CPU) Result: FAIL
Download (untitled) / with headers
text/plain 920b
Here is another one with even stranger results, the first line of the string starts with two spaces, the second line starts with no spaces, but does have a run of whitespace in the middle of the string. The failure mode changes depending on how many spaces are in the run (in the script, the failure is different for different values of $i). If $i is 1, 2, or 3, then the roundtripping simply fails as in the previous report (losing one of the two leading spaces), if $i is 4 or greater then I get a YAML_PARSE_ERR_INCONSISTENT_INDENTATION. use strict; use warnings; use Test::More tests => 30; use YAML qw( Dump Load ); for my $i ( 1 .. 10 ) { my $in = " F S UID PID\n040 S root" . ( ' ' x $i ) . "14\n"; ok( my $yaml = Dump( $in ), "Dump successful ($i)" ); ok( my $out = eval { Load( $yaml ) }, "Load successful ($i)" ); if ( $@ ) { warn $@ } is( $out, $in, "Roundtrip successful ($i)" ); }
Download (untitled) / with headers
text/plain 246b
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/89 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.