13930 Commits

Author SHA1 Message Date
Eric Huss
6fa758e83c Fix flaky not_found_permutations test. 2023-04-14 08:01:34 -07:00
bors
b0742b2145 Auto merge of #11882 - hi-rustin:rustin-patch-clippy-fix, r=weihanglo
Correct the bug report for `cargo clippy --fix`
2023-04-14 07:05:37 +00:00
hi-rustin
08169fd015 Add rustc_shim_for_cargo_fix and wrapped_clippy_driver to reuse code
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 11:23:41 +08:00
hi-rustin
47f6e2ddc9 Add broken_clippy_fixes_backed_out
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 10:46:53 +08:00
hi-rustin
3a880a2b39 Correct the bug report for cargo clippy --fix
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 10:46:47 +08:00
bors
84b7041fd2 Auto merge of #11950 - ehuss:stabilize-logout, r=epage
Stabilize `cargo logout`

This stabilizes the `cargo logout` command.

Closes #11910
Closes #11884
2023-04-13 20:08:40 +00:00
bors
38376893bd Auto merge of #11878 - ehuss:header-diagnostics, r=weihanglo
Add more information to HTTP errors to help with debugging.

This adds some extra information to the HTTP error message about some headers and the remote IP address that could potentially be useful in diagnosing issues.

Closes #8691
2023-04-12 18:57:04 +00:00
Eric Huss
84bcf0e247 Add x-amz-request-id (for the S3 side of things) and add comments. 2023-04-12 11:50:53 -07:00
Eric Huss
a70c108961 Stabilize cargo logout 2023-04-12 09:56:43 -07:00
Eric Huss
c00a633bd6 Don't display headers in spurious warning message.
The headers can significantly contribute to noise in the output,
drowning out the rest of the output. Most investigation will likely be
focused on the case where cargo completely fails to download, so this
only shows the full detail in the final error message.
2023-04-12 09:38:53 -07:00
Eric Huss
4702fa3ad3 Include the IP address in HTTP errors. 2023-04-12 09:38:53 -07:00
Eric Huss
c7c9b8f32b Show some HTTP headers in error messages. 2023-04-12 09:38:52 -07:00
bors
96f8d6ced8 Auto merge of #11949 - ehuss:logout-default, r=epage
Use registry.default for login/logout

This changes `cargo login` and `cargo logout` to use the registry configured at `registry.default` as the registry instead of crates.io. For `cargo login`, this was an unintentional regression from #6466. The documentation has always stated that it will use the default registry.

This makes the command more in line with other registry-involving commands. There are still some inconsistencies.

These commands use the default if not specified:

* `cargo init`
* `cargo new`
* `cargo owner`
* `cargo search`
* `cargo yank`
* `cargo publish` uses the default, but will also look at the `publish` field `Cargo.toml` and use that if the registry is not specified.

These commands would always use crates.io if `--registry` is not specified:

* `cargo login`
* `cargo logout`
* `cargo install`

I'm a bit uncertain how to proceed, since this is technically a breaking change particularly if someone has scripted it. I suspect that the number of users that use `registry.default` is very small, and those that script `cargo login` are even smaller, and thus the intersection is probably small or nonexistent. However, there is some risk here.
2023-04-12 13:45:57 +00:00
bors
1ce01c5e58 Auto merge of #11960 - ehuss:chdir-unstable, r=weihanglo
Change -C to be unstable

Due to #11957, we have decided to change `-C` to be unstable to give us some more time to decide on how it should behave.
2023-04-12 09:23:44 +00:00
Eric Huss
3da2b3c67b Mark -C as unstable 2023-04-11 19:46:05 -07:00
Eric Huss
a9e0b505d6 Update auth error message to specify args for cargo login. 2023-04-10 10:20:21 -07:00
bors
7bf43f028b Auto merge of #11956 - epage:spec, r=Muscraft
docs(pkgid): Consistently use @

Fixes #11955
2023-04-10 16:01:41 +00:00
Ed Page
b0eb0a8a9e docs(pkgid): Consistently use @
Fixes #11955
2023-04-10 08:50:38 -05:00
bors
c429784fd5 Auto merge of #11951 - ehuss:check-token-tab, r=hi-rustin
Fix credential token format validation.

The existing validation incorrectly excluded tab because of a missing backslash. This updates to add the backslash.

This also rewords the comments. I found the current comments to be a little confusing.

This also extends the test to verify more valid inputs.

cc #11600
2023-04-10 04:02:43 +00:00
bors
1a53cdb31f Auto merge of #11952 - ehuss:check-token-publish, r=weihanglo
Validate token on publish.

The `publish` path was not validating the token like the other API routes were (like owner, or yank). This does not appear to be intentional from what I can tell. This consolidates the relevant code so that it is shared with all the API calls.

cc #11600

Closes #11571
2023-04-10 00:54:41 +00:00
bors
34cb1ea6b8 Auto merge of #11947 - ehuss:c-before-command, r=weihanglo
Clarify docs on `-C` that it appears before the command.

The docs for `-C` currently don't mention that it must appear before the command name. This is the only root option that behaves this way that is documented in every page (except for `+toolchain`, which already mentions its position restriction). This adds some text to explain this restriction.
2023-04-09 23:40:29 +00:00
Eric Huss
35f5862979 Validate token on publish. 2023-04-09 12:15:40 -07:00
Eric Huss
57264ed433 Fix credential token format validation. 2023-04-09 11:53:46 -07:00
Eric Huss
9ba2ca2034 Clarify docs on -C that it appears before the command. 2023-04-09 09:58:06 -07:00
Eric Huss
117eb4b33f Use registry.default for login/logout 2023-04-09 09:30:36 -07:00
Eric Huss
0e13f667c8 Add tests for registry.default for login/logout 2023-04-09 09:22:28 -07:00
Eric Huss
91d39bc742 Share the check_token function between login and logout tests. 2023-04-09 09:11:22 -07:00
bors
1b2de2169b Auto merge of #11866 - Zoxc:fs-non-canon, r=ehuss
Add `try_canonicalize` and use it over `std::fs::canonicalize`

This adds a `try_canonicalize` function that calls `std::fs::canonicalize` and on Windows falls back to getting an absolute path. Uses of `canonicalize` have been replaced with `std::fs::canonicalize`. On Windows `std::fs::canonicalize` may fail due to incomplete drivers. In particular `ImDisk` does not support it.

Combined with https://github.com/rust-lang/rust/pull/109231 this allows compiling crates on an `ImDisk` RAM disk and I've tested that it works with various configuration using [rcb](https://github.com/Zoxc/rcb).
2023-04-08 19:32:31 +00:00
Eric Huss
5430956b4a
Fix misspelling 2023-04-08 12:27:04 -07:00
bors
39684ff0aa Auto merge of #11944 - atouchet:rd, r=epage
Fix typo

I assume this is supposed to be possessive and not plural.
2023-04-07 16:43:17 +00:00
Alex Touchet
2ddee8c93a
Fix typo 2023-04-07 09:35:38 -07:00
bors
b9379ea53f Auto merge of #11943 - Muscraft:fix-changelog, r=epage
docs(changelog): Change wording about auto-fix message

The wording in the changelog regarding the auto-fix message specified that it would show for "warnings/errors", but Cargo only shows the message for warnings currently.

The reason that errors were not included was that there were concerns with `rustfix`/`cargo`'s ability to deal with errors, so we decided to skip showing it when there were any errors.
2023-04-07 02:32:08 +00:00
bors
a5ca31deda Auto merge of #11941 - atouchet:rep, r=ehuss
Update home repo URL

According to the Readme in https://github.com/brson/home this is the new location of the home repository.
2023-04-07 01:49:16 +00:00
Scott Schafer
eb71bc85fb docs(changelog): Change wording about auto-fix message 2023-04-06 20:01:12 -05:00
bors
9fb2294371 Auto merge of #11942 - cuviper:patch-1, r=ehuss
doc(changelog): `[env]` is a table, not a stable
2023-04-07 01:00:42 +00:00
Josh Stone
0aae5ebb9a
doc(changelog): [env] is a table, not a stable 2023-04-06 17:52:09 -07:00
Alex Touchet
91d431f95d Update repo URL 2023-04-06 15:29:11 -07:00
bors
60aaca6d5e Auto merge of #11937 - arlosi:fuzzy, r=ehuss
Stop using UncanonicalizedIter for QueryKind::Exact

`QueryKind::Exact` causes unnecessary HTTP requests when querying for crates that don't exist. Even though the query is `Exact`, when fetching `Summaries`, Cargo still uses `UncanonicalizedIter` and requests additional possible crate names if the first one isn't found.

This change moves the use of `UncanonicalizedIter` further up the call stack such that we have the `QueryKind` available, and only do the additional queries for `QueryKind::Fuzzy`.

The impact is most noticeable when publishing a new crate that contains `-` or `_`. Since Cargo waits for publish by querying the registry, if the crate name is `my-example-test-crate`, Cargo currently makes 8 HTTP requests each second while waiting for the crate to be available. With this fix, Cargo makes only 1 request per second.

cc #11934
2023-04-06 16:38:29 +00:00
Arlo Siemsen
a888c94052 Stop using UncanonicalizedIter for QueryKind::Exact 2023-04-05 15:52:01 -05:00
bors
41f78881d1 Auto merge of #11936 - ehuss:uncanonicalized-path-prefix, r=arlosi
Don't query permutations of the path prefix.

This fixes the use of the `UncanonicalizedIter` to not create permutations that are not valid paths if the crate has a dash or underscore in the first four characters of the name.

Previously it was permuting the path in the prefix, creating invalid paths. For example, `my-tool` would create a path like `my/_t/my-tool` which isn't valid since the filename doesn't match the prefix directories.

This fixes it so that it permutes just the name, and then generates the index path *after* permuting it.

The test included here goes from 16 queries to just 4 queries.

Fixes #11935
2023-04-05 04:23:28 +00:00
Eric Huss
1ee340c0a7 Don't query permutations of the path prefix. 2023-04-04 18:49:42 -07:00
bors
5a5c7e8ba3 Auto merge of #11931 - JohnTheCoolingFan:master, r=ehuss
Fix typo in variable name

Just fixes a typo in a variable name (it was "vsces" instead of "vcses", derived from VCS, meaning Version Control System).
2023-04-04 16:48:15 +00:00
bors
8e11d864b6 Auto merge of #11930 - arlosi:sparse-warning, r=epage
Fix Cargo warning about unused sparse configuration key

When doing a credential lookup, Cargo deserializes the registry configuration and detects the `registries.crates-io.protocol` key as unused and issues a warning:
```
warning: unused config key `registries.crates-io.protocol` in [..]
```

This fixes the issue by adding the field to the `RegistryConfig` struct.
2023-04-04 01:14:44 +00:00
bors
23e3d8ba22 Auto merge of #11933 - ehuss:benchsuite-archive, r=epage
Switch benchsuite to the index archive.

Due to the index squash this morning, the commit of the index that the benchsuite was using is no longer available. This switches to the archive which contains the complete history of the index and shouldn't have issues with commits going away.
2023-04-03 23:47:59 +00:00
Eric Huss
610cc5c918 Switch benchsuite to the index archive. 2023-04-03 14:29:43 -07:00
JohnTheCoolingFan
0cf3a2289e
Fix typo in variable name 2023-04-03 21:06:29 +03:00
Arlo Siemsen
a1cba8fe49 Fix Cargo warning about unused sparse configuration key
When doing a credential lookup, Cargo deserializes the registry configuration and detects the
registries.crates-io.protocol key as unused and issues a warning.

This fixes the issue by adding the field to the struct
2023-04-03 11:27:11 -05:00
bors
ac32aa812b Auto merge of #11928 - ehuss:update-git2, r=epage
Update git2

This updates git2 from 0.16 to 0.17, which updates libgit2 from 1.5.0 to 1.6.3. This is quite a large update (particularly around SSH handling), so this update is fairly risky. All of the issues I'm aware of have been resolved.

Due to some changes in how libgit2 handles SSH agent errors, I tweaked the wording of the error generated by cargo when all authentications fail. Previously, libgit2 would abort the authentication when an ssh-agent connection failed.

Changelog for git2: https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md#0170---2023-04-02
Changelog for libgit2: https://github.com/libgit2/libgit2/blob/main/docs/changelog.md#v163

Closes #11611
2023-04-03 14:20:14 +00:00
bors
02401872a1 Auto merge of #11926 - ehuss:publish-api-index-docs, r=weihanglo
Publish docs: Clarify requirements about the state of the index after publish.

The current Publish API docs don't mention anything about the requirements of updating the index asynchronously, so this adds some information about how cargo handles that.
2023-04-03 00:14:19 +00:00
bors
7618951b11 Auto merge of #11927 - ehuss:index-json-doc-differences, r=weihanglo
Call out the differences between the index JSON and the API or metadata.

This adds some clarifications to the differences between the index JSON format and the Publish API and `cargo metadata`. This seems to be a common source of confusion for registry implementers, so hopefully this will highlight the differences and make them more evident.
2023-04-02 23:22:38 +00:00