Commit graph

14722 commits

Author SHA1 Message Date
Weihang Lo 862226fc60
chore: window-sys should be a platform-specific dependency 2023-08-12 09:17:18 +01:00
bors 3a73377919 Auto merge of #12479 - weihanglo:credential, r=epage
doc: note the backward compatible `.cargo/credential` file exists
2023-08-11 16:35:27 +00:00
Weihang Lo 94a1217789
doc: note the backward compatible .cargo/credential file exists 2023-08-11 17:25:58 +01:00
bors 3705df02e3 Auto merge of #12475 - compiler-errors:unelided-lifetime, r=epage
Fix elided lifetime in associated const

Fix an unelided lifetime in an associated const.

The old code was equivalent to:

```rust
impl<'a> RegistryConfig {
    /// File name of [`RegistryConfig`].
    const NAME: &'a str = "config.json";
}
```

and not `&'static str`, as it might be in a regular `const` item.

This "regressed" in rust-lang/rust#97313, which started allowing this behavior (inadvertently, as far as I can tell). It's not necessarily clear to me that this is sound (or at least, it's not something we intended to be able to express), but it's also preventing me from doing crater runs to investigate fallout of this issue (rust-lang/rust#114713 and rust-lang/rust#114716).
2023-08-11 02:28:46 +00:00
Michael Goulet b4a26b0f4c Fix elided lifetime in associated const 2023-08-11 01:10:32 +00:00
bors 7da103076e Auto merge of #12463 - stupendoussuperpowers:nocapture_test_msg, r=epage
prompt the use of `--nocapture` flag if `cargo test` process is terminated via a signal.

Fixes #10855

As per the discussion on this issue, we want to prompt the user to use `--nocapture` if a test is terminated abnormally. The motivation for this change is described in the issue.

We check for 3 things before we display this flag. -
- `!is_simple` (if the test ended with a non 101 status code)
- `harness` (if the standard test harness was used), and
- `!nocapture` (whether or not the `--nocapture` flag was already passed to the test)

There's further tests added to `test::nonzero_exit_status` that check that the `stderr` is correct for the various combinations possible when a test ends with a non-101 status code.

The new expected behavior is -
- Display `--nocapture` note for only non-zero exit statuses, when the `--nocapture` flag is not passed.
- Only display the note if we use a standard test harness since custom test harnesses do not implement the `--nocapture` flag.

To implement the check for the `--nocapture` flag, the function definition for `report_test_errors` was changed to add the `test_args: &[&str]` parameter. This parameter is passed from the immediate calling function. This private function is only called twice change and is not causing regression after making the appropriate changes to both the places it's called in.
2023-08-10 21:20:25 +00:00
bors 54550ef7a3 Auto merge of #12469 - arlosi:cred-stdio, r=weihanglo
cargo-credential: reset stdin & stdout to the Console

Credential providers run with stdin and stdout piped to Cargo to communicate. This makes it more difficult for providers to do anything interactive. The current workaround is for a provider to use the `cargo_credential::tty()` function when reading from the console by re-opening stdin using `/dev/tty` or `CONIN$`.

This PR makes the credential provider to re-attach itself to the current console so that reading from stdin and writing to stdout "just works" when inside the `perform` method of the provider. stderr is unaffected since it's not redirected by Cargo.

Only the `cargo-credential` crate is changed. No changes are needed to Cargo.

cc #8933
2023-08-10 20:20:00 +00:00
Arlo Siemsen 5ade1ad1eb cargo-credential: reset stdin & stdout to the Console 2023-08-10 13:33:33 -05:00
bors af431e1bb7 Auto merge of #12454 - alcolmenar:alcolmenar/fix-invalid-rm, r=epage
Fix cargo remove incorrectly removing used patches

### What does this PR try to resolve?

Fixes an issue where patches are being removed when member dependencies don't explicitly contain the patched crate.

Fixes #12419

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

- Created a test for the failing use case
- Verify passing test

<!--
### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.

-->
2023-08-10 18:00:32 +00:00
alcolmenar 72e66fb645
fix: add quiet verbosity around resolve and fix tests 2023-08-10 09:51:36 -07:00
alcolmenar a64ed3976f
fix: add gc unused patches logic and fix tests 2023-08-10 07:27:36 -07:00
alcolmenar 7ad774a3ff
chore: add passing test 2023-08-10 07:27:24 -07:00
bors 7ed917f2fc Auto merge of #12466 - epage:renovate, r=arlosi
chore(gh): Expand update window

I've been having some repos not updated lately.  RenovateBot project's theory is that its because RenovateBot is scheduled to run once every 3 hours and checks the schedule at that point while the schedules I use only offers an exact 3 hour window, making this a race condition.  The schedule originally came from RenovateBot but they changed their polling schedule.

See https://github.com/renovatebot/renovate/discussions/23642#discussioncomment-6618560
2023-08-09 22:40:04 +00:00
alcolmenar dde256fb93
fix: ensure patches are different dependencies to enable unused 2023-08-09 13:09:41 -07:00
sanchit dd8cd9c9a9 add nocapture message to report_test_err 2023-08-10 01:16:27 +05:30
sanchit dde17cf0cf add --nocapture tests 2023-08-10 01:16:00 +05:30
bors 1d43be107b Auto merge of #12468 - arlosi:http-debug-crash, r=weihanglo
Fix panic when enabling http.debug for certain strings

Fixes an issue where enabling HTTP debugging may attempt to slice a string across a character boundary resulting in a panic. This likely occurs when binary HTTP data happens to be valid UTF-8.

By interpreting the strings as `&[u8]` before slicing, (which is what `eq_ignore_ascii_case` did internally anyway), the panic is no longer possible.

Closes #12459

r? `@weihanglo`
2023-08-09 17:31:03 +00:00
Arlo Siemsen 13f1da927c Fix an issue where enabling HTTP debugging may attempt to slice a string across a character boundry resulting in a panic 2023-08-09 11:36:55 -05:00
bors 2b3554f773 Auto merge of #11905 - epage:help_heading, r=weihanglo
fix(cli): Make `--help` easier to browse

This mirrors some of the categories from `cargo help` (the man pages) using [`clap::Arg::help_heading`](https://docs.rs/clap/latest/clap/struct.Arg.html#method.help_heading).
There are fewer categories to avoid extra vertical space.  Instead, they
are left int the `Options` category but put first.

The goal is to try to make it easier to scan `--help` output as the list of flags can get quite long and its easy to miss what features are there.
2023-08-08 20:35:52 +00:00
Ed Page e03aa57eb0 chore(gh): Expand update window
I've been having some repos not updated lately.  RenovateBot project's theory is
that its because RenovateBot is scheduled to run once every 3 hours and
checks the schedule at that point while the schedules I use only offers
an exact 3 hour window, making this a race condition.  The schedule
originally came from RenovateBot but they changed their polling
schedule.

See https://github.com/renovatebot/renovate/discussions/23642#discussioncomment-6618560
2023-08-08 15:14:48 -05:00
Ed Page 853102f7de fix(cli): Make --help easier to browse
This mirrors some of the categories from `cargo help` (the man pages).
There are fewer categories to avoid extra vertical space.  Instead, they
are left int the `Options` category but put first.
2023-08-08 13:50:05 -05:00
bors a07a12ac05 Auto merge of #12447 - belovdv:jobserver-remove-env-var, r=weihanglo
fix: preserve jobserver file descriptors on rustc invocation to get `TargetInfo`

Then cargo asks rustc for `TargetInfo`, cargo passes environment variables that describe jobserver file descriptors, but doesn't actually passed them, because `jobserver-rs` sets `FD_CLOEXEC` by default and expects users to explicitly call `Client::configure` to pass them further. Rustc respects make jobserver, so this causes error - env vars refers to nonexistent file descriptors, which is ignored now.

This PR makes cargo compatible with https://github.com/rust-lang/rust/pull/113730, which attempts to catch such situations.
2023-08-08 09:28:41 +00:00
Daniil Belov 1e12538c96 pass jobserver on target info acquiring 2023-08-08 10:59:55 +03:00
bors 211fd7eac1 Auto merge of #12458 - weihanglo:tracing, r=epage
refactor: migrate to `tracing`
2023-08-07 20:59:03 +00:00
bors 27e73b3412 Auto merge of #12461 - arlosi:cred-doc, r=epage
docs: add example for cargo-credential

Add additional docs and example for `cargo-credential`.

r? `@epage`
2023-08-07 20:13:27 +00:00
Arlo Siemsen af95711ae5 Add more docs and example for cargo-credential 2023-08-07 13:00:56 -05:00
bors d432dec355 Auto merge of #12332 - hi-rustin:rustin-patch-syntax, r=arlosi
Bail out an error when using cargo:: in custom build script
2023-08-07 16:58:15 +00:00
Weihang Lo 964c083ea1
doc(logging): update mentions of log to tracing 2023-08-07 12:02:19 +01:00
Weihang Lo 9d707e4b9a
chore: remove log, env_logger, and pretty_env_logger 2023-08-07 12:02:19 +01:00
Weihang Lo 7e69050c64
refactor: setup tracing-subscriber 2023-08-07 12:02:19 +01:00
Weihang Lo 23561f36a1
chore: add tracing-subscriber crate 2023-08-07 11:25:41 +01:00
Weihang Lo de39bdd30a
refactor: replace log with tracing in network debugging 2023-08-07 11:25:41 +01:00
Weihang Lo e84cc17db6
refactor: rustfmt for tracing 2023-08-07 11:25:41 +01:00
Weihang Lo af1a78b424
refactor: find & replace log:: -> tracing::
Except HTTP network debugging
2023-08-07 11:25:40 +01:00
Weihang Lo 9f0565e985
chore: add tracing crate 2023-08-07 11:21:55 +01:00
bors abc115972e Auto merge of #12439 - arlosi:registry-multiple-warning, r=ehuss
Fix printing multiple warning messages for unused fields in [registries] table

Cargo currently prints the same warning message multiple times for unexpected fields in the `[registries.<registry>]` or `[registry]` tables. This is because Cargo warns each time that the structure is deserialized from `Config`. Depending on which code path is taken I've seen the warning printed up to 6 times.

* A cache of deserialized registry configurations is added to the `Config` struct.
* Registry authentication is changed to directly read the config when searching for a registry name, rather than deserializing each registry configuration.

A test is added to ensure both `[registries]` and `[registry]` only warn once for unexpected fields.
2023-08-06 18:29:22 +00:00
bors b644a40a1f Auto merge of #12453 - ehuss:update-windows, r=epage
Update windows dependencies

This updates some windows dependencies primarily to drop old versions of windows-sys.

miow changelog: https://github.com/yoshuawuyts/miow/blob/master/CHANGELOG.md#v060---2023-08-04
schannel changes: https://github.com/steffengy/schannel-rs/compare/v0.1.21...v0.1.22

Note that miow is mostly unmaintained now. We may need to consider finding new maintainers, taking on maintenance, or finding an alternate solution.
2023-08-05 23:29:16 +00:00
bors f761921206 Auto merge of #12451 - ehuss:fmt-let-else, r=weihanglo
Rustfmt a let-else statement

Beta and nightly rustfmt require that this is formatted correctly.
2023-08-05 21:42:43 +00:00
Eric Huss c4b0e6b95a Update schannel from 0.1.21 to 0.1.22 2023-08-05 14:28:15 -07:00
Eric Huss 850ff884e8 Update miow from 0.5.0 to 0.6.0 2023-08-05 14:27:40 -07:00
bors f9c45a66d8 Auto merge of #12450 - ehuss:allow-internal_features, r=epage
Add allow(internal_features)

https://github.com/rust-lang/rust/pull/108955 has added a new deny-by-default lint to reject internal features, which is causing tests to fail on nightly. This adds an `allow` to work around that.
2023-08-05 19:58:53 +00:00
Eric Huss 988eebe222 Rustfmt a let-else statement 2023-08-05 12:13:08 -07:00
Eric Huss 1df0f1d734 Add allow(internal_features) 2023-08-05 12:11:07 -07:00
bors bfb0d197d2 Auto merge of #12445 - ehuss:update-pretty-env-logger, r=weihanglo
Update pretty_env_logger to 0.5

This updates pretty_env_logger from 0.4.0 to 0.5.0. The primary motivation is to drop some dependencies like `atty`.

https://github.com/seanmonstar/pretty-env-logger/compare/v0.4.0...v0.5.0
I think the main change is updating to env_logger 0.7 to 0.10 which syncs with what is normally used by cargo.
2023-08-03 23:13:19 +00:00
bors 3a4a7429c6 Auto merge of #12444 - ehuss:remove-build-metadata, r=weihanglo
Remove build metadata from libgit2-sys dependency

This removes the `+1.6.4` build metadata from the libgit2-sys dependency because it causes cargo to generate a warning every time it is used.
2023-08-03 22:23:44 +00:00
Eric Huss c753612408 Remove build metadata from libgit2-sys dependency 2023-08-03 15:14:50 -07:00
Eric Huss 580bbf90f8 Update pretty_env_logger to 0.5 2023-08-03 15:14:02 -07:00
bors d78bbf4bde Auto merge of #12443 - pietroalbini:pa-cve-2023-38497-nightly, r=weihanglo
Fix CVE-2023-38497 for master

Changes have been made by `@weihanglo` and reviewed by `@ehuss` in a private repository.
2023-08-03 12:58:25 +00:00
Weihang Lo c60c06585c
fix: clear cache for old .cargo-ok format
In 1.71, `.cargo-ok` changed to contain a JSON `{ v: 1 }` to indicate
the version of it. A failure of parsing will result in a heavy-hammer
approach that unpacks the `.crate` file again. This is in response to a
security issue that the unpacking didn't respect umask on Unix systems.
2023-08-03 13:42:54 +01:00
Weihang Lo 4fafa69a4d
fix: respect umask when unpacking .crate files
Without this, an attacker can leverage globally writable files buried
in the `.crate` file. After a user downloaded and unpacked the file,
the attacker can then write malicous code to the downloaded sources.
2023-08-03 13:41:08 +01:00