rust-lang / rust-lang/git2-rs

`impl Read for OdbReader` breaks semantics of Read, and doesn't provide any indication of EOF

Open
#639 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
450
Avg merge
11m
Merged PRs (30d)
1

Description

The underlying git_odb_stream_read doesn't give any EOF indication, and instead seems to expect the caller to track the remaining bytes manually based on the object size.

As a result, the implementation of Read for OdbReader doesn't follow the normal semantics of Read; it always returns the length it was given, and never indicates EOF or a short read.

We could fix this relatively easily by tracking the object size ourselves, with one hiccup: OdbReader implements Binding, which doesn't give any opportunity to initialize the object further beyond the raw pointer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Read implementation for OdbReader, the Binding trait, and the git_odb_stream_read call described in the issue. Trace how the object size could be retained during initialization without changing the raw-pointer binding contract. Done means reads follow normal short-read and EOF semantics while preserving the existing binding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.