Hi Max,

I installed fresh ubuntu 22.04.

    PRETTY_NAME="Ubuntu 22.04.5 LTS"

Then installed rust 1.85 and git from repositories:

    $ apt install git rust-1.85-all

For simplicity patched PATH and checked version:

    $ export PATH="/lib/rust-1.85/bin:$PATH"
    $ rustc --version
      rustc 1.85.1 (4eb161250 2025-03-15) (built from a source tarball)

Created rust project (crate) from template into 'experiment'
subdirectory:

    $ cargo new --vcs none --bin experiment
        Creating binary (application) `experiment` package

Cargo generates the following 'Cargo.toml' configuration:

    $ cat ./experiment/Cargo.toml

    [package]
    name = "experiment"
    version = "0.1.0"
    edition = "2024"
    [dependencies]

After that I added git dependency on rand (it may be any other very popular 
rust crate).
I added the following line to 'Cargo.toml' file inside 'experiment'
directory (to section "[dependencies]"):

    [dependencies]
    rand = { git = "https://github.com/rust-random/rand.git";, tag = "0.8.5" }

Also changed required rust edition to 2021 in 'Cargo.toml' file
otherwise older compilers will not compile:

    edition = "2021"

Now it is enough to fetch dependencies using 'cargo fetch' command
from the root of the created project ('experiment' directory):

    $ cargo fetch
    
    Updating git repository `https://github.com/rust-random/rand.git`
    error: failed to get `rand` as a dependency of package `experiment v0.1.0 
(/home/dmitry/experiment)`

    Caused by:
      failed to load source for dependency `rand`

    Caused by:
      Unable to update https://github.com/rust-random/rand.git?tag=0.8.5

    Caused by:
      failed to fetch into: /home/dmitry/.cargo/git/db/rand-fe0ee6bed158a0f1

    Caused by:
      invalid version 0 on git_proxy_options; class=Invalid (3)

Then I installed 1.82 rust version and tested it:

    $ apt install git rust-1.82-all
    $ PATH="/lib/rust-1.82/bin:${PATH}" rustc --version
      rustc 1.82.0 (f6e511eec 2024-10-15) (built from a source tarball)
    $ PATH="/lib/rust-1.82/bin:${PATH}" cargo fetch
        Updating git repository `https://github.com/rust-random/rand.git`
        Updating crates.io index
      Downloaded unicode-ident v1.0.22
      Downloaded cfg-if v1.0.4
      Downloaded ppv-lite86 v0.2.21
      Downloaded wasi v0.11.1+wasi-snapshot-preview1
      Downloaded quote v1.0.44
      Downloaded zerocopy-derive v0.8.37
      Downloaded getrandom v0.2.17
      Downloaded proc-macro2 v1.0.106
      Downloaded zerocopy v0.8.37
      Downloaded syn v2.0.114
      Downloaded libc v0.2.180
      Downloaded 11 crates (1.7 MB) in 0.30s

You can see that cargo 1.82 is able to fetch dependencies. Also checked 
rust-1.83-all
and it does not work.

It is interesting that rust-1.83-all requires libgit2:

    The following additional packages will be installed:
      cargo-1.83 libgit2-1.1 libhttp-parser2.9 libmbedcrypto7 libmbedtls14 
libmbedx509-1
      libstd-rust-1.83 libstd-rust-1.83-dev rust-1.83-clippy rust-1.83-gdb 
rustc-1.83 rustfmt-1.83 

Only 1.83 version depends on libgit2:

    $ ldd /lib/rust-1.82/bin/cargo | grep git
    $ ldd /lib/rust-1.83/bin/cargo | grep git
        libgit2.so.1.1 => /lib/x86_64-linux-gnu/libgit2.so.1.1 
(0x00007fa8c6669000)
    $ ldd /lib/rust-1.85/bin/cargo | grep git

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2139436

Title:
  cargo fetch fails with "invalid version 0 on git_proxy_options" error

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rustc-1.85/+bug/2139436/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to