Ticket #1911 (closed bug: worksforme)

Opened 11 years ago

Last modified 11 years ago

cannot read binary file stream

Reported by: x19290 Owned by:
Priority: normal Milestone:
Component: none Version: 2.10.0
Severity: medium Keywords: open binary
Cc: Language: perl6
Patch status: Platform: linux

Description

In rakudo-star-2010.11,

my $h = open '/dev/urandom', :bin; loop (;;) {

$h.read(256);

}

spits

Malformed UTF-8 string

in 'IO::read' at line 5402:CORE.setting

In perl-language@…, Andrew Whitworth told me its parrot issue and to open this ticket.

Attachments

read_urandom.pir Download (0.7 KB) - added by plobsing 11 years ago.
PIR reading 256 characters from urandom with pretty formatting

Change History

Changed 11 years ago by x19290

Code was poorly formatted.

my $h = open '/dev/urandom', :bin;
loop (;;) {
    $h.read(256);
}

Changed 11 years ago by plobsing

PIR reading 256 characters from urandom with pretty formatting

Changed 11 years ago by plobsing

  • status changed from new to closed
  • resolution set to worksforme

1) Parrot can read binary files (see read_urandom.pir). This is a rakudobug. 2) My recent copy of rakudo (8f10c4b94ea6) does not choke on this. Reading from the handle produces a Buf object (not a Str), and therefore does not perform any encoding/decoding.

Note: See TracTickets for help on using tickets.