Skip to content

pread(0,0) raises EOFError #66

@jdelStrother

Description

@jdelStrother

@casperisfine / @byroot thanks for the pread implementation!

However, there's a slight difference in how it treats the edge case of reading zero bytes from an empty file

File.open("empty_file").pread(0,0) # => ""
StringIO.new(File.read("empty_file")).pread(0,0) # => raises `end of file reached (EOFError)`

In our case, this is almost certainly a bug in the application logic where it ought to bail out early rather than trying to read zero bytes from the io, but thought it was worth highlighting the discrepancy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions