Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active June 20, 2019 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/74e32577f8f79b368e3785fd7d4e0008 to your computer and use it in GitHub Desktop.
Save dogbert17/74e32577f8f79b368e3785fd7d4e0008 to your computer and use it in GitHub Desktop.
Valgrind error
t/45_eol.t from [Tux] CSV repo
ok 754 - Allow whitespace
ok 755 - Trailing \r with no escape char
==11455== Invalid read of size 4
==11455== at 0x50DAD0F: cache_sep_info (decode_stream.c:633)
==11455== by 0x50DAD0F: MVM_string_decode_stream_sep_from_strings (decode_stream.c:689)
==11455== by 0x50A3204: MVM_decoder_set_separators (Decoder.c:197)
==11455== by 0x501917C: MVM_interp_run (interp.c:5073)
==11455== by 0x5128983: MVM_vm_run_file (moar.c:444)
==11455== by 0x4011E5: main (in /home/dogbert/.rakudobrew/versions/moar-master/install/bin/perl6-m)
==11455== Address 0xa20f43c is 4 bytes before a block of size 0 alloc'd
==11455== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11455== by 0x50DABE8: MVM_malloc (alloc.h:2)
==11455== by 0x50DABE8: MVM_string_decode_stream_sep_from_strings (decode_stream.c:681)
==11455== by 0x50A3204: MVM_decoder_set_separators (Decoder.c:197)
==11455== by 0x501917C: MVM_interp_run (interp.c:5073)
==11455== by 0x5128983: MVM_vm_run_file (moar.c:444)
==11455== by 0x4011E5: main (in /home/dogbert/.rakudobrew/versions/moar-master/install/bin/perl6-m)
==11455==
ok 756 - Auto-detecting \r
this is the code which causes this
{ my $csv = Text::CSV.new ();
my $fh = open $efn, :w;
$fh.nl-out = "#\r\n";
$csv.print ($fh, [ "a", 1 ]);
close $fh;
$fh = open $efn, :r;
$fh.nl-in = "";
#is ($fh.get, "a,1#\r\n", "Strange \$\\"); # TODO
$fh.close;
unlink $efn;
}
{ my $csv = Text::CSV.new (eol => $*OUT.nl-out);
my $fh = open $efn, :w;
$fh.nl-out = "#\r\n";
$csv.print ($fh, [ "a", 1 ]);
close $fh;
$fh = open $efn, :r;
$fh.nl-in = "";
#is ($fh.get, "a,1#\r\n", "Strange \$\\ + eol"); # TODO
$fh.close;
unlink $efn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment