-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
git: don't update submodules in offline mode #10730
git: don't update submodules in offline mode #10730
Conversation
When we're running in --offline mode, don't try to update git submodules or else we're bail out with a network error if it's actually inaccessible.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. Please see the contribution instructions for more information. |
Can you add a test that demonstrates the issue? From your response on the issue, I still can't tell when this would be needed. |
I'm not sure if I can even trigger this issue outside of yocto. I'm not familiar with the test-suite in cargo. I would need to prepare a filesystem that has its own crate registry pointed to by CARGO_HOME with a git repository that has submodules but which would fail when trying to update it. Is there any example of some tests already doing anything remotely similar? If that's of any use - here's a patch series I submitted for upstream openembedded-core: https://lists.openembedded.org/g/openembedded-core/message/166627 |
There are several tests in https://github.com/rust-lang/cargo/blob/master/tests/testsuite/git.rs that set up git submodules as dependencies. |
Building current cargo master fails for me:
Is there any fix for that yet? |
@brgl you need to be building with 1.59 |
What version of Rust are you using? assume_init was stabilized for const fn in 1.59. |
if !cargo_config.offline() { | ||
checkout.update_submodules(cargo_config)?; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change should be moved into update_submodules
. We should probably just mimic #10717 which also tells the user what is happening
That should probably provide good test examples
I've started working on a test-case that should more or less recreate what we do in yocto and started hitting a different issue - cargo bails out before even trying to update or checkout git revisions in offline mode like here or here. That doesn't seem correct. What if the remote we're using is a local one, with the |
@ehuss I have one missing piece for the test case. In order to reproduce what yocto does (and how the issue gets triggered) I need to be in a state where I have a locked revision for the repo containing submodules (easy) and also have a preexisting database. For the latter - I don't know how to do it and can't find any test cases that would do something similar. My test case looks like this right now:
I guess something needs to be done before |
It's still not clear to me what this is trying to accomplish, so I can't really provide any advice. Before using |
I'm not sure how familiar you are with build tools aimed at embedded linux systems but the short story is this: yocto is a set of tools for creating custom linux distros. It uses a language called bitbake for creating so called recipes - they contain instructions on how to build various packages (different languages, build systems etc.). For various reasons that I won't bore you with, yocto doesn't use So it prepares the database as if it were I simply don't know cargo enough to recreate this situation. I can easily reproduce the issue in yocto and can give you instructions on how to do this, but you're probably not interested in non-standard usage which I can understand but I also want to fix the use-case that's making me carry out-of-tree openembedded-core patches. |
☔ The latest upstream changes (presumably #11106) made this pull request unmergeable. Please resolve the merge conflicts. |
It sounds like this is trying to address an issue with an external tool trying to modify cargo's internal cache. I would recommend not doing that, as the internal cache isn't something that external tools should be modifying. There are other mechanisms for using sources fetched from external tools, such as source replacement. I'm going to close as it doesn't appear to be a specific issue with using If there are higher-level concerns about how to separately download sources that source replacement or other mechanisms don't address, then that might be good to discuss as a feature request or on the users or internals forum. |
When we're running in --offline mode, don't try to update git submodules or else we're bail out with a network error if it's actually inaccessible.
This addresses the issue raised here: #10727