rust-lang / rust-lang/git2-rs

Runtime error if zlib-ng feature is missing

Open
#849 1 comment 1 reaction 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

If zlib-ng is enabled through any other dependency but the git2/zlib-ng-compat feature is missing a error reading from the zlib stream; class=Zlib (5). is shown at runtime. This error is very hard to debug because there is no indication that this is caused by zlib-ng. Minimal example:

[package]
name = "git-repro"
version = "0.1.0"
edition = "2021"

[dependencies]
git2 = "0.14.4"
# To enable zlib-ng-compat for the zig build
libssh2-sys = { version = "0.2.23" }

[features]
default = ["vendored"]
vendored = ["git2/vendored-libgit2", "git2/vendored-openssl"]
zlib-ng-compat = ["libssh2-sys/zlib-ng-compat"]
use git2::Repository;

fn main() {
    Repository::clone(
        "https://github.com/IQTLabs/hypothesis-bio",
        "hypothesis-bio",
    )
    .unwrap();
    println!("Hello, world!");
}

Fails (Error { code: -1, klass: 5, message: "error reading from the zlib stream" }):

cargo run --features vendored --features zlib-ng-compat

Passed:

cargo run --features vendored

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 with the minimal Rust example and compare the two cargo run commands shown in the issue, then inspect how the git2 and libssh2-sys feature combinations affect zlib-ng. Done means the failing configuration no longer produces an opaque zlib stream error, or clearly identifies the missing zlib-ng compatibility configuration; verify both command paths.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.