Skip to content

Cargo tries to update git submodules even with build.submodules = false and --offline #10727

Closed as not planned
@brgl

Description

@brgl

Problem

For dependencies downloaded with git and containing submodules, cargo tries to update those submodules even if config.toml sets build.submodules to false and --offline flag is used.

The problem can be observed with the gst-plugins-rs project and results in the following example error:

| NOTE: cargo build -v --target x86_64-poky-linux --release --manifest-path=/home/brgl/workspace/rust-dev-yocto/build/tmp/work/core2-64-poky-linux/gstreamer1.0-plugins-rs/0.8.4-r0/git//Cargo.toml --offline
|     Updating git submodule `https://github.com/gtk-rs/gir`
| error: failed to get `gstreamer` as a dependency of package `gst-plugin-tutorial v0.8.4 (/home/brgl/workspace/rust-dev-yocto/build/tmp/work/core2-64-poky-linux/gstreamer1.0-plugins-rs/0.8.4-r0/git/tutorial)`
| 
| Caused by:
|   failed to load source for dependency `gstreamer`
| 
| Caused by:
|   Unable to update https://gitlab.freedesktop.org/gstreamer/gstreamer-rs?branch=0.18#9ee22baa
| 
| Caused by:
|   failed to update submodule `gir`
| 
| Caused by:
|   failed to fetch submodule `gir` from https://github.com/gtk-rs/gir
| 
| Caused by:
|   can't update a git repository in the offline mode
| WARNING: exit code 101 from a shell command.

There seems to be no way to fully disable network access and make cargo trust that the available sources are up to date.

Steps

cargo build --offline

Possible Solution(s)

No response

Notes

The problem is relevant with the yocto build system which disables name resolution when compiling and fetches all sources on its own.

Version

cargo 1.60.0
release: 1.60.0
host: x86_64-linux
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/3.0.0c)
os: OracleLinux 22.4.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions