Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corrupt deflate stream on OpenBSD 6.6 and cargo 1.38.0 #7559

Open
monarrk opened this issue Nov 4, 2019 · 7 comments
Open

corrupt deflate stream on OpenBSD 6.6 and cargo 1.38.0 #7559

monarrk opened this issue Nov 4, 2019 · 7 comments
Labels
C-bug Category: bug O-openbsd OS: OpenBSD S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@monarrk
Copy link

monarrk commented Nov 4, 2019

Problem

Cargo is unable to install binaries and libraries on OpenBSD 6.6. I get an error from flate2 saying corrupt deflate stream

Steps

  1. Install OpenBSD 6.6 x86_64
  2. Use pkg_add rust to get rustc and cargo
  3. Attempt to install something using cargo install
  4. Attempt to install dependencies using cargo build in a project with dependencies

Possible Solution(s)

Update flate2?

Notes
Output of cargo version:
cargo 1.38.0

Output of rustc -V:
rustc 1.38.0

Output of uname -a:
OpenBSD bandwagonbox 6.6 GENERIC.MP#304 i386

Full error with backtrace:

% RUST_BACKTRACE=1 cargo install cargo-xbuild -vvv
    Updating crates.io index
error: failed to download `cargo-xbuild v0.5.18`

Caused by:
  unable to get packages from source

Caused by:
  failed to unpack package `cargo-xbuild v0.5.18`

Caused by:
  failed to iterate over archive

Caused by:
  corrupt deflate stream

I know that OpenBSD is not supported by rustup, but I am hoping that this can be fixed regardless.

Thank you very much!

@monarrk monarrk added the C-bug Category: bug label Nov 4, 2019
@ehuss
Copy link
Contributor

ehuss commented Nov 13, 2019

I was able to set up OpenBSD 6.6, installed rust 1.38 with pkg_add rust, and was able to use Cargo to build and install remote packages without any problems.

Can you maybe try to run Cargo with the environment variables CARGO_HTTP_DEBUG=true and CARGO_LOG=cargo::ops::registry=debug and see if there is anything interesting in the output? I'd also check to see if there is any unusual network configuration, proxies, .cargo/config files, etc.

@ehuss
Copy link
Contributor

ehuss commented Nov 13, 2019

You may also consider deleting the ~/.cargo/registry/ directory to see if it got corrupted somehow.

@ehuss
Copy link
Contributor

ehuss commented Dec 3, 2019

I'm going to close without a reproduction, but if you have further information or question, feel free to ask or reopen.

@ehuss ehuss closed this as completed Dec 3, 2019
@dragonmaus
Copy link

dragonmaus commented Feb 6, 2020

@ehuss:

I was able to set up OpenBSD 6.6, installed rust 1.38 with pkg_add rust, and was able to use Cargo to build and install remote packages without any problems.

Can you maybe try to run Cargo with the environment variables CARGO_HTTP_DEBUG=true and CARGO_LOG=cargo::ops::registry=debug and see if there is anything interesting in the output? I'd also check to see if there is any unusual network configuration, proxies, .cargo/config files, etc.

One question: Were you using a 64-bit OpenBSD installation? I have the same problem, and like @monarrk, I am running on 32-bit OpenBSD (uname -a -> OpenBSD titanium.home 6.6 GENERIC.MP#3 i386). I also have a separate, 64-bit machine with an otherwise identical setup, and everything works fine there.

@ehuss
Copy link
Contributor

ehuss commented Feb 7, 2020

Ah, yes, I am able to reproduce on 32-bit OpenBSD.

It looks like the problem is the mz_stream definition is not correct on 32-bit OpenBSD. The call to mz_inflateInit2 is failing because it is using libz which checks the size of that structure. I think the issue is that the Rust code defines total_in and total_out as c_ulong which is 32-bits, but OpenBSD's actual libz definition is z_off_t which is off_t which is int64_t.

I'm not really sure if there's an easy fix. libz-sys's type definitions don't match what OpenBSD does. Maybe the types would need to be customized for OpenBSD? Not sure if they'd be willing to support that. Or maybe the OpenBSD port could patch libz-sys?

@ehuss ehuss reopened this Feb 7, 2020
@ehuss ehuss added the O-openbsd OS: OpenBSD label Feb 7, 2020
@epage
Copy link
Contributor

epage commented Nov 2, 2023

Since this, we've switched from miniz-sys to the zlib backend. @dragonmaus can you confirm if this is still an issue?

@epage epage added the S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. label Nov 2, 2023
@dragonmaus
Copy link

Since this, we've switched from miniz-sys to the zlib backend. @dragonmaus can you confirm if this is still an issue?

Sorry for the radio silence. The 32-bit laptop I was running this instance of OpenBSD on kicked the bucket, and I haven't had the time to resurrect or replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug O-openbsd OS: OpenBSD S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants