Skip to content

io: ReadFull should not forward io.ErrUnexpectedEOF from underlying reader #47677

@dsnet

Description

@dsnet

The logic for io.ReadFull returns errors from the underlying io.Reader verbatim.

In the case where io.Reader returns io.ErrUnexpectedEOF, it is impossible for the caller of io.ReadFull to distinguish between whether:

  • the underlying io.Reader abruptly ended and is in a truncated state, or
  • the underlying io.Reader ended correctly and there is no more data.

To avoid this ambiguity, we should wrap any io.ErrUnexpectedEOF from the underlying io.Reader.

However, I suspect that this is a breaking change and the best that we can hope for is to just document this.

\cc @josharian @catzkorn

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions