Commit Graph

12912 Commits

Author SHA1 Message Date
Eric Huss ad779e08be
known_hosts: Switch the documentation to stable.
When making the stable release, the nightly docs won't be updated, yet.
This makes sure that the link will work for the stable release.
2023-01-10 14:41:19 +01:00
Eric Huss 200cc11b5e
Bump to 0.67.1, update changelog. 2023-01-10 14:41:18 +01:00
Eric Huss cb9eeffdfb
ssh known_hosts: support hashed hostnames 2023-01-10 14:41:17 +01:00
Eric Huss 895031c4c1
Add test for config Value in TOML array. 2023-01-10 14:41:15 +01:00
Eric Huss 1ad1d3db10
Remove let-else, just use ? propagation.
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2023-01-10 14:41:13 +01:00
Eric Huss e8999621be
Add some known_hosts tests.
This also fixes a bug with the host matching when there are comma-separated hosts.
2023-01-10 14:41:12 +01:00
Eric Huss c552222a72
Support configuring ssh known-hosts via cargo config. 2023-01-10 14:41:11 +01:00
Eric Huss 95c98116e3
Add support for deserializing Vec<Value<String>> in config.
This adds the ability to track the definition location of a string
in a TOML array.
2023-01-10 14:41:09 +01:00
Eric Huss c9bff1ec6d
Validate SSH host keys 2023-01-10 14:41:07 +01:00
bors d65d197ad5 Auto merge of #11381 - ehuss:beta-fix-safe-directory, r=weihanglo
[beta-1.66] Backport fix for git2 safe-directory disable

Beta backports:

* #11366 — fix git2 safe-directory disable
* #11332 — fix semver documentation for change in non_exhaustive
* #11335 — Clean more aggressively in CI
2022-11-15 21:30:31 +00:00
bors 4d1d2b2ace Auto merge of #11335 - ehuss:space-test, r=epage
Clean more aggressively in CI

The Windows x86_64 gnu CI job is running dangerously low on disk space. This PR adds another step to delete test output more aggressively. The test output with x86_64-pc-windows-gnu is nearly 9.5GB. The benchmark step is adding about 1GB of space (unfortunately it is rebuilding cargo, which may be hard to avoid without a workspace).

Eventually we should probably look at figuring out how to reduce the amount of disk space used by the testsuite. Perhaps something like #9701 (see comments there). Or, making aggressive changes to the tests themselves. Many tests can probably be changed to use `cargo check` instead of `cargo build` (or maybe even `cargo tree`). We can default to not generating debuginfo. Or perhaps there are other changes to put the tests on a diet.
2022-11-15 12:37:28 -08:00
bors e3daada15f Auto merge of #11332 - weihanglo:fix-semver-check, r=Muscraft
fix(semver-check): adapt to a different error for variant not covered
2022-11-15 12:36:31 -08:00
bors 6774bc1118 Auto merge of #11366 - ehuss:fix-safe-directory, r=epage
Fix git2 safe-directory disable

The call to `set_verify_owner_validation` was not getting called unless a network configuration was found. This means in the common case that `cargo new` will fail when there is a safe-directory error. This fixes the issue by making sure that `set_verify_owner_validation` is called before the early-exits in `init_git_transports`.

Fixes #11365
2022-11-15 11:13:27 -08:00
bors 7e484fc1a7 Auto merge of #11062 - epage:wait, r=weihanglo
fix(publish): Block until it is in index

Originally, crates.io would block on publish requests until the publish
was complete, giving `cargo publish` this behavior by extension.  When
crates.io switched to asynchronous publishing, this intermittently broke
people's workflows when publishing multiple crates.  I say interittent
because it usually works until it doesn't and it is unclear why to the
end user because it will be published by the time they check.  In the
end, callers tend to either put in timeouts (and pray), poll the
server's API, or use `crates-index` crate to poll the index.

This isn't sufficient because
- For any new interested party, this is a pit of failure they'll fall
  into
- crates-index has re-implemented index support incorrectly in the past,
  currently doesn't handle auth, doesn't support `git-cli`, etc.
- None of these previous options work if we were to implement
  workspace-publish support (#1169)
- The new sparse registry might increase the publish times, making the
  delay easier to hit manually
- The new sparse registry goes through CDNs so checking the server's API
  might not be sufficient
- Once the sparse registry is available, crates-index users will find
  out when the package is ready in git but it might not be ready through
  the sparse registry because of CDNs

So now `cargo` will block until it sees the package in the index.
- This is checking via the index instead of server APIs in case there
  are propagation delays.  This has the side effect of being noisy
  because of all of the "Updating index" messages.
- This blocks by default but there is an unstable `publish.timeout` config field that will disable blocking when set to 0.  See #11222 for stablization

Blocking is opt-out as that is the less error prone case for casual users while those doing larger integrations are also likely to do the testing needed to make more complicated scenarios work where blocking is disabled.

Right now we block after the publish.  An alternative would be to block until all dependencies are in the index which makes the blocking only happen when needed
- Blocking on dependencies can be imprecise to detect when to block vs propagate an error up
- This is the less error prone case for users.  For example I recently publish a crate in one tab and immediately switched to another tab to use it and this only worked because `cargo-release` blocked until it was ready to use

In reviewing this change, be sure to look at the individual commits
- The first makes it possible to write the tests for this
- The second adds a test that shows the current behavior
- The third updates the test to the expected behavior, showing all of this works

In addition to the publish tests:
- We want to maximize the nightly-to-stable time to collect feedback
- We will put this in TWiR's testing section to raise visibility

Fixes #9507
2022-10-27 15:20:57 +00:00
bors 1985caf190 Auto merge of #11292 - arlosi:compression, r=epage
Add Accept-Encoding request header to enable compression

### What does this PR try to resolve?

Cargo does not request compression from servers. Enabling compression can save bandwidth and improve performance.

### How should we test and review this PR?

I validated locally that the header was being sent using a local proxy (Fiddler). It sent `Accept-Encoding: deflate, gzip` on Windows.
2022-10-27 01:37:25 +00:00
bors 1c1e9a61cb Auto merge of #11294 - ehuss:highfive-docs, r=weihanglo
Update contrib docs for highfive transition

As of #11293, this repo is now using triagebot (AKA `@rustbot)` for auto-assignment of PRs. This PR updates the contributor documentation to accommodate this change.
2022-10-27 00:16:45 +00:00
Eric Huss cf38262995 Update contrib docs for highfive transition 2022-10-26 16:58:34 -07:00
bors 1cb94b0733 Auto merge of #11293 - ehuss:highfive-triagebot, r=Mark-Simulacrum
Migrate from highfive to triagebot

This migrates the rust-lang/cargo repo to use triagebot instead of highfive.
2022-10-26 23:19:08 +00:00
bors 1945b44853 Auto merge of #11287 - Rageking8:fix-dupe-word-typos, r=weihanglo
Fix dupe word typos
2022-10-26 07:41:02 +00:00
Rageking8 61813d9d72 fix dupe word typos 2022-10-26 12:15:45 +08:00
bors da63337681 Auto merge of #11283 - arlosi:sparse-error, r=weihanglo
Fix confusing error messages when using -Zsparse-registry

Built-in replacements of crates.io have confusing a description:
> crates.io index (which is replacing registry `crates-io`)

This adds a special case for built-in source replacements of `crates-io`. User-defined replacements of crates.io continue to use the existing description.

Also fixes the test framework `__CARGO_TEST_CRATES_IO_URL_DO_NOT_USE_THIS` variable to strip the `sparse+` prefix when checking if a url `is_crates_io`.

Fixes #11277
2022-10-26 04:09:55 +00:00
Arlo Siemsen 7c89237104 Add Accept-Encoding request header to enable compression 2022-10-25 17:36:39 -05:00
bors 9210810d1f Auto merge of #11286 - ehuss:410-gone, r=Eh2406
Fix 410 gone response handling

This changes the sparse-registry support for the 410 "Gone" HTTP response code. This is out of sync with the [load function](8adf1df292/src/cargo/sources/registry/http_remote.rs (L375)) mentioned in the comment. I assume it is supposed to be 410 and not 401 since 401 is "Unauthorized", and that doesn't signify that the resource is "not found".

r? `@arlosi`
2022-10-25 22:31:50 +00:00
Eric Huss c8c6a963c0 Fix 410 gone response handling 2022-10-25 14:45:41 -07:00
Arlo Siemsen 40293266b2 Fix confusing error messages when using -Zsparse-registry 2022-10-25 13:51:43 -05:00
bors 8adf1df292 Auto merge of #11281 - smheidrich:fix-stale-mtime-log-ineq, r=ehuss
Fix inequality in "stale mtime" log messages

### What does this PR try to resolve?

If `CARGO_LOG=cargo::core::compiler::fingerprint=info` is set, cargo will print log messages that are useful for finding out why something is being recompiled. E.g. if the modification time (mtime) of a source file is newer than the cached build result, it will print something like:

```
stale: changed "/host//home/runner/.cargo/registry/src/github.com-1285ae84e5963aae/proc-macro2-1.0.47/build.rs"
          (vs) "/host/home/runner/target/release/build/proc-macro2-45f04ea9067a46ed/output"
               FileTime { seconds: 1666559031, nanos: 16426033 } != FileTime { seconds: 1666559080, nanos: 324117075 }
```

However, the `!=` in the log message is misleading, as equality is not the [criterion that's actually used](071eeaf210/src/cargo/core/compiler/fingerprint.rs (L1761)) to determine when to rebuild.

This PR fixes that by changing `!=` to `<`, corresponding to the actual criterion.

### How should we test and review this PR?

Look at the [criterion](071eeaf210/src/cargo/core/compiler/fingerprint.rs (L1761)) I linked and trace `stale_mtime` in the log message back to `path_mtime` in said criterion to see why it has to be `<`.
2022-10-25 02:55:45 +00:00
Eric Huss 92bdd2582f Migrate from highfive to triagebot 2022-10-24 09:32:22 -07:00
bors 62b6d5a112 Auto merge of #11282 - weihanglo:doc/cargo-tree, r=epage
doc(cargo-tree): mention it considering feature unification
2022-10-24 16:25:26 +00:00
Weihang Lo 4a76339cb5
doc(cargo-tree): mention it considering feature unification 2022-10-24 23:27:03 +08:00
bors 19d37d29b1 Auto merge of #11280 - hi-rustin:rustin-patch-error-msg, r=weihanglo
Improve the error message if `publish` is `false` or empty list

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/11262

Improve the error message if `publish` is the false or empty list.

Say `publish` is set to `false` or an empty list in Cargo.toml and prevents publishing.
### How should we test and review this PR?

Unit test

### Additional information

If there was a way we could tell `publish` to be empty or `false`, I think it would get better. If you know an easy way to implement it, please feel free to comment.
2022-10-24 15:17:27 +00:00
hi-rustin 6c9f36d99b Update not in list error message
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-24 22:50:25 +08:00
hi-rustin 66a8488cf6 Update error messages for tests
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-24 21:25:47 +08:00
bors 6e9da768f5 Auto merge of #11278 - ehuss:deleted-entry-test, r=epage
Add test for deleted index entry

This adds a test for when an entry is deleted from the index. This is done on crates.io occasionally for things like copyright takedown requests.

This behavior was tripping a debug assert which this removes. I'm not entirely certain why the debug assert is there, but I think it is not correct, since this is obviously a scenario where there might be a cached file, but the index responds with NotFound.
2022-10-24 13:14:51 +00:00
smheidrich f3fd53d544 Fix inequality in "stale mtime" log messages 2022-10-24 01:27:32 +02:00
hi-rustin 3bbd5a5dbe Improve error message if `publish` is false or empty list
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-23 15:51:35 +08:00
Eric Huss 5e6da66c03 Add test for deleted index entry 2022-10-22 18:20:52 -07:00
bors 071eeaf210 Auto merge of #11273 - epage:toml, r=weihanglo
fix: Remove leading newline in vendor output

This supersedes #11271
2022-10-22 01:17:55 +00:00
bors 174ec748c3 Auto merge of #11268 - arlosi:fix-sparse-publish, r=ehuss
Fix publishing with a dependency on a sparse registry

### What does this PR try to resolve?
On publishing, the `registry_index` field was being set to the registry URL without the `sparse+` prefix. During the verification build, Cargo would attempt to fetch the registry as a `git` registry. Caused by #11209.

Fixes #11263.

### How should we test and review this PR?

Added a test that fails without the change.
2022-10-22 00:17:11 +00:00
Ed Page a9f704aaaa fix: Remove leading newline in vendor output
This supersedes #11271
2022-10-21 12:27:21 -05:00
Arlo Siemsen 49fb8f3d88 Fix publishing with a dependency on a sparse registry 2022-10-20 17:21:32 -05:00
bors b1b25a0255 Auto merge of #11265 - hi-rustin:rustin-patch-missing, r=epage
Add missing edition

When I read this doc, I found that we are missing the edition key in this manifest. I think we should add it because` cargo new` always does this.
2022-10-20 14:55:24 +00:00
hi-rustin 96bf10e1d4 Add missing edition
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-20 21:52:43 +08:00
bors a6e72d0a27 Auto merge of #11255 - epage:registry, r=arlosi
fix(publish): Check remote git registry more than once post-publish

With `publish-timeout` on remote git registries, we were checking once and never checking again.  There were 3 layers of guards preventing the cache from being updating
- `needs_update`, handled via `invalidate_cache`
- `config.updated_sources()`,. handled by removing from the HashSet
- `updated`, inaccessible

This change collapses `updated` into `config.updated_sources()`, allowing the cache to be updated

Tested by publishing `epage-publish-test`.  After about 7 registry updates, it succeded.  Before, it just hit the timeout of 60s.  No tests are added as we don't have the plumbing setup to be able to control when the test remote git registry publishes.  All of our tests focus on the remote http registry.

Fixes #11253
2022-10-20 11:17:03 +00:00
bors bab91cafb3 Auto merge of #11258 - hi-rustin:rustin-patch-typo, r=weihanglo
Fix typo

### What does this PR try to resolve?
It's `first-come-first-serve` not `first-come-first- serve`.
<img width="743" alt="image" src="https://user-images.githubusercontent.com/29879298/196712847-f575615a-2538-45ae-915a-64406dc5c7e8.png">
2022-10-20 03:55:34 +00:00
hi-rustin 49b0fbbb26 Fix typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-19 21:59:15 +08:00
Ed Page dd696741fd fix(publish): Check remote git registry more than once post-publish
With `publish-timeout` on remote git registries, we were checking once
and never checking again.  There were 3 layers of guards preventing the
cache from being updating
- `needs_update`, handled via `invalidate_cache`
- `config.updated_sources()`,. handled by removing from the HashSet
- `updated`, inaccessible

This change collapses `updated` into `config.updated_sources()`,
allowing the cache to be updated

Tested by publishing `epage-publish-test`.  After about 7 registry
updates, it succeded.  Before, it just hit the timeout of 60s.  No tests
are added as we don't have the plumbing setup to be able to control when
the test remote git registry publishes.  All of our tests focus on the
remote http registry.

Fixes #11253
2022-10-18 11:39:41 -05:00
bors 3ff044334f Auto merge of #11243 - weihanglo:refactor/cargo_compile, r=epage
Some tiny refactors around `ops::cargo_compile`

### What does this PR try to resolve?

Some tiny refactors I found during polishing documentations.

- Extract `CompileFilter` and `Packages` from `ops::cargo_compile` to their own modules.
- Remove `FilterRule::try_collect` as its intent is not clear, and we don't need this indirection.
- Remove `CompileOptions::local_rustdoc_args`, which is obsolete since 1ef954ea.
2022-10-17 20:25:00 +00:00
Weihang Lo 886c9d2153
refactor(cargo_compile): move to mod.rs 2022-10-18 01:59:12 +08:00
bors e008032442 Auto merge of #11241 - weihanglo:doc/build_context, r=epage
Polish docs for module `build_context`
2022-10-17 12:27:27 +00:00
bors 76293b3ade Auto merge of #11247 - arlosi:fix-sparse, r=Eh2406
Remove sparse+ prefix for index.crates.io

### What does this PR try to resolve?

#11209 changed how sparse registry URLs are stored in a `SourceId` to remove the `sparse+` prefix, however the URL was not updated.

Fixes #11246

### How should we test and review this PR?

Run a command that requires sparse registry `cargo  -Z sparse-registry update --dry-run`

Tests can't really be added for this case, since the `index.crates.io` URL was incorrect, and tests shouldn't access the network.

r? `@Eh2406`
2022-10-16 22:48:25 +00:00