15286 Commits

Author SHA1 Message Date
bors
739624fdc2 Auto merge of #12730 - cuishuang:master, r=epage
Fix some typos
2023-09-25 15:31:12 +00:00
bors
4a470d5a8f Auto merge of #12731 - Byron:gitoxide-upgrade, r=weihanglo
upgrade gitoxide to v0.54

This reduces the binary size and fixes an exploitable bug that could allow
code execution by injection arguments into hostnames of ssh URLs.

##### Binary Sizes (Release)

* `master`: 27930520
* this branch: 27869304 - a whopping 61216B less. I assume this will get worse again once more functionality will be used in future PRs.

##### Possible Vulnerability

In versions prior to v0.54, running the following would cause the calculator app to be started on MacOS:

```
❯ gix clone 'ssh://-oProxyCommand=open$IFS-aCalculator/foo'
```

Now it prints `Error: Host name '-oProxyCommand=open-aCalculator' could be mistaken for a command-line argument`.

Given the nature of builds with `cargo` and the availability of build scripts, I think `cargo` isn't prone to this issue. However, I thought it was good to upgrade anyway.

Please note that a CVE doesn't exist yet, but I will check with Rustsec on how to proceed with this.
CC `@Shnatsel`

### Tasks

* [x] fix tests - the bug was introduced in 74ce8639e8 and it leads the local symref  `refs/remotes/origin/HEAD` to point to a non-existing branch.
    - This is a feature, but one with the shortcoming that it's allowed to point to a none-existing ref, and that ref is not automatically created, yet,  and it's not covered by a refspec. Previously it would just let the symbolic ref point to the peeled object that is known.
2023-09-25 13:29:22 +00:00
Sebastian Thiel
3f7d556131
upgrade gitoxide to v0.54
This reduces the binary size and fixes an exploitable bug that could allow
code execution by injection arguments into hostnames of ssh URLs.
2023-09-25 13:53:06 +02:00
Tom Scanlan
9839454e6c
rebuild static docs for cargo-publish 2023-09-24 20:42:05 -04:00
Tom Scanlan
a79fdbb3ad
docs: warn about upload timeout 2023-09-24 17:18:12 -04:00
Tom Scanlan
3393fdc528
more specific registry index not found msg 2023-09-24 15:43:18 -04:00
bors
c031b0c69e Auto merge of #12720 - chenx97:mipsr6-update, r=weihanglo
Update target-arch-aware crates to support mips r6 targets
2023-09-24 16:17:34 +00:00
Henry Chen
277368d8cc Update target-arch-aware crates to support mips r6 targets
This includes libc itself and dependencies that rely on
rustix 0.37.

command used for the update:

```shell
cargo update -p is-terminal
```
2023-09-24 23:18:43 +08:00
cui fliter
c8f4d234bb Fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-24 23:10:07 +08:00
bors
12860b6d79 Auto merge of #12727 - ehuss:buffered-shell, r=epage
Buffer console status messages.

This adds buffering to some of the console output. This can help with interleaved output, particularly with things like the log output interleaving with status messages. This fixes that interleaving by atomically writing the entire status message, which in turn, helps fix some spurious errors such as https://github.com/rust-lang/cargo/issues/12639.

I'm uncertain what the performance impact of this change might have. It might improve performance, since there should be a lot fewer syscalls, and I suspect terminals will be able to handle it more efficiently (and particularly across a network connection). However, I don't know if that will have a noticeable impact.

Only the "status" messages are buffered. Everything else is still unbuffered as before.
2023-09-23 00:43:13 +00:00
bors
5369c99f81 Auto merge of #12726 - ehuss:fix-token_not_logged, r=arlosi
Fix spurious errors with networking tests.

This fixes an issue where some networking tests could behave erratically. In particular, the `registry_auth::token_not_logged` has been failing somewhat often (see https://github.com/rust-lang/cargo/issues/12639). The issue is that curl can behave inconsistently based on whether or not it immediately detects that the connection has closed or not, which is not done consistently. HTTP 1.1 defaults to `Connection: open`, so this mini HTTP server was essentially not standards compliant. `Connection: close` tells curl to expect the connection to close ([ref](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection)).
2023-09-22 21:12:47 +00:00
Eric Huss
902b07351d Buffer console writing. 2023-09-22 13:40:56 -07:00
Eric Huss
ebea09d8f4 Fix spurious errors with networking tests. 2023-09-22 13:37:26 -07:00
bors
25dcec9f43 Auto merge of #12675 - weihanglo:source-id, r=arlosi
refactor(SourceId): merge `name` and `alt_registry_key` into one enum
2023-09-22 18:42:55 +00:00
bors
414d9e3a6d Auto merge of #12722 - lovesegfault:validate-pkg-root, r=weihanglo
refactor(TomlManifest): fail when package_root is not a directory

### What does this PR try to resolve?

Currently, if you're trying to use `TomlManifest::to_real_manifest`, and
you pass in something incorrect as the `package_root`, such as the path
to the package's manifest, you will get a weird error that looks like
this:

```
can't find library `dummy_lib`, rename file to `src/lib.rs` or specify lib.path
```

This is not very helpful, so this change makes us check that
`package_root` is a directory, and reports an error early on if it
isn't.
2023-09-22 07:03:57 +00:00
Weihang Lo
23e91c3d84
refactor: use registry_key for getting crates.io key
`registry_key` should always be `crates-io` when `is_crates_io()` is true

This also removes the test verifying `Debug` output,
whose format doesn't need to be guaranteed.
2023-09-22 14:36:41 +08:00
Weihang Lo
17fdd58761
refactor: merge name and alt_registry_key into one enum
Both `name` and `alt_registry_key` are mainly used for displaying.
We can safely merge them into one enum.
However, `alt_registry_key` is also used for telling if a SourceId is
from `[registries]` so we need to provide functions to distinguish that.
2023-09-22 14:36:41 +08:00
hi-rustin
61648f583e Add test for unsupported silent flag 2023-09-22 10:50:23 +08:00
Bernardo Meurer
c30151b173
refactor(TomlManifest): fail when package_root is not a directory
Currently, if you're trying to use `TomlManifest::to_real_manifest`, and
you pass in something incorrect as the `package_root`, such as the path
to the package's manifest, you will get a weird error that looks like
this:

```
can't find library `dummy_lib`, rename file to `src/lib.rs` or specify lib.path
```

This is not very helpful, so this change makes us check that
`package_root` is a directory, and reports an error early on if it
isn't.
2023-09-21 15:26:01 -04:00
Weihang Lo
a30d9fde98
test: verify source replacement displays registry key 2023-09-21 12:53:24 +08:00
bors
5bf83d8146 Auto merge of #12693 - hi-rustin:rustin-patch-unsupported-flags, r=epage
Better suggestion for unsupported mode in build command
2023-09-21 02:40:07 +00:00
hi-rustin
97656fbf87 Correct the helper name and the tip message 2023-09-21 10:12:03 +08:00
bors
da73cc6564 Auto merge of #12718 - ehuss:update-curl, r=epage
Update curl-sys to pull in curl 8.3.0

This is a routine update to update curl to 8.3.0

There was a minor security issue, but I do not think it is an issue for cargo.

Changelog: https://curl.se/changes.html#8_3_0
Summary: https://daniel.haxx.se/blog/2023/09/13/curl-8-3-0/
2023-09-20 18:37:19 +00:00
Eric Huss
7ada8392d0 Update curl-sys to pull in curl 8.3.0 2023-09-20 11:17:40 -07:00
bors
d829727e2f Auto merge of #12716 - epage:renovate, r=arlosi
chore(ci): Ignore patch version in MSRV

1. Its extra churn to be forced to update patch releases
2. #12654 adds `cargo hack` which doesn't handle MSRV patch versions well
2023-09-20 15:43:06 +00:00
bors
376b9a75bd Auto merge of #12711 - weihanglo:cached, r=epage
refactor: move cached crates.io SourceID to config module
2023-09-20 14:52:44 +00:00
Ed Page
f328f03600 chore(ci): Ignore patch version in MSRV
1. Its extra churn to be forced to update parch releases
2. #12654 adds `cargo hack` which doesn't handle MSRV patch versions
   well
2023-09-20 09:07:48 -05:00
bors
37dd3d9dfa Auto merge of #12714 - arlosi:cred-typos, r=weihanglo
fix: typos in registry authentication documentation

r? `@weihanglo`
2023-09-20 08:25:55 +00:00
bors
2607058a22 Auto merge of #12712 - weihanglo:unstable-flag, r=arlosi
doc: mention unstable flag `-Z asymmetric-token`
2023-09-20 07:07:48 +00:00
bors
0134bb602c Auto merge of #12688 - lf-:jade/efi-pdbs, r=arlosi
fix: copy PDBs for EFI targets
2023-09-20 06:14:30 +00:00
Arlo Siemsen
3401b89cf0 fix: typos in registry-authentication documentation 2023-09-20 00:54:07 -05:00
Weihang Lo
ac5da12382
doc: mention unstable flag -Z asymmetric-token
Co-authored-by: Arlo Siemsen <arsiem@microsoft.com>
2023-09-20 13:46:31 +08:00
bors
d1e246f584 Auto merge of #12713 - weihanglo:label, r=arlosi
infra: add auto-trigger rules for new labels
2023-09-20 05:29:18 +00:00
Weihang Lo
7f492cd2bf
infra: add auto-trigger rules for new labels 2023-09-20 13:28:42 +08:00
hi-rustin
817c2cbbb5 Better suggestion for unsupported mode in install command 2023-09-20 11:31:36 +08:00
hi-rustin
7644a4bd96 Add test for using unsupported mode in install command 2023-09-20 11:27:56 +08:00
hi-rustin
ed86337492 Better suggestion for unsupported mode in build command 2023-09-20 11:24:44 +08:00
hi-rustin
f262297e9a Add test for using unsupported mode in build command 2023-09-20 11:23:01 +08:00
bors
e3f2e8fb03 Auto merge of #12709 - arlosi:cred-link, r=ehuss
fix: use channel-specific link for registry auth error

The current error message for attempting to use a private registry without a credential provider will be a dead link until it's stabilized in 1.74. This makes the URL dependent on the channel.

r? `@ehuss`
2023-09-20 03:13:05 +00:00
bors
f57c80ebf3 Auto merge of #12638 - ehuss:clean-updates, r=epage
Add some enhancements to `cargo clean`

### What does this PR try to resolve?

This adds some enhancements to `cargo clean` that fell out as a result of some refactorings in #12634 for supporting an interface for cleaning from other places in cargo, and these were relatively easy to add and assist with testing in #12634.

The changes are:
- Introduce some refactoring to offer a cleaning interface that can be used elsewhere in cargo.
- Adds a `--dry-run` CLI option which will print what `cargo clean` will delete without deleting it. **NOTE** This PR makes the flag insta-stable. I don't figure there is too much that can be learned about it keeping it unstable, though we could change that. #12634 has this flag gated with `-Zgc`.
- Adds a summary line at the end of the `cargo clean` operation that indicates how much was deleted.

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

Note that this PR also includes the changes from #12635 and #12637. Those commits can be dropped if those PRs are merged.

For the most part, this involves wrapping the cleaning operations in a `CleanContext` which provides an interface for performing cleaning operations. The dry run is just a flag that is checked at the deletion points. The summary data is also collected at those same points.
2023-09-20 02:25:46 +00:00
Eric Huss
655f75db0a Add cargo --dry-run to the documentation. 2023-09-19 18:24:45 -07:00
Eric Huss
c2047345bd Don't display paths with cargo clean --dry-run without --verbose
The paths themselves aren't particularly interesting.
2023-09-19 18:24:45 -07:00
Eric Huss
f61d42d5ef Add a warning to cargo clean --dry-run
This makes it more consistent with other `--dry-run` commands, and
makes it clearer to the user that cargo did not do anything.
2023-09-19 18:24:45 -07:00
Eric Huss
ebee726d8f Separately track files and directories removed.
The previous status line was a little awkward in the way it combined
both counts. I don't think showing the directories is particularly
interesting, so they are only displayed when no files are deleted.
2023-09-19 18:24:37 -07:00
Eric Huss
e9110aac54 Use Self type. 2023-09-19 18:19:54 -07:00
Eric Huss
e7e354c85b Use existing arg_dry_run function.
And drop the `-n` short flag until we decide to commit to using it
generally.
2023-09-19 18:19:53 -07:00
Eric Huss
495ed7ebe2 Add a summary to cargo clean.
This adds a summary at the end when `cargo clean` finishes that displays
how many files and bytes were removed.
2023-09-19 18:16:40 -07:00
Eric Huss
45c5394703 Add a --dry-run option to cargo clean.
This adds a `--dry-run` option to have `cargo clean` display what it
would delete without actually deleting it.
2023-09-19 18:14:47 -07:00
Eric Huss
61e8ef30d9 Wrap clean operations in a CleanContext.
This refactors some of the `cargo clean` code to wrap the "cleaning"
operation in a `CleanContext` so that the context can be passed to other
parts of cargo which can perform their own cleaning operations.

There are some minor changes in the error messages to prepare for
cleaning operations that aren't directly related to the build directory.
2023-09-19 18:14:13 -07:00
Weihang Lo
1fa386e1c4
refactor: move cached crates.io SourceID to config module
`SourceId` should know nothing about `config` caching.
2023-09-20 09:08:58 +08:00