Skip to content
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

Don't panic when printing JSON with non-utf8 paths #9226

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

matklad
Copy link
Member

@matklad matklad commented Mar 2, 2021

Before:

λ cd \Xff/foo/ && cargo verify-project && cargo metadata
{"success":"true"}
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("path contains invalid UTF-8 characters", line: 0, column: 0)', /rustc/a5a775e3f9e8043dad405e00aee0ae60882a7b71/src/tools/cargo/src/cargo/core/shell.rs:346:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After:

λ cd \Xff/foo/ && $cargo verify-project && $cargo metadata
{"success":"true"}
warning: please specify `--format-version` flag explicitly to avoid compatibility problems
error: path contains invalid UTF-8 characters

I am pretty sure that this has zero real-world impact, but the diff is
small, so why not handle it?

@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 2, 2021
@alexcrichton
Copy link
Member

Seems reasonable to me, thanks!

Could you be sure to add a test for this as well?

@matklad
Copy link
Member Author

matklad commented Mar 2, 2021

added!

shell.nix Outdated
@@ -0,0 +1 @@
/home/matklad/config/shell.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray files being added?

Before:

    λ cd \Xff/foo/ && cargo verify-project && cargo metadata
    {"success":"true"}
    warning: please specify `--format-version` flag explicitly to avoid compatibility problems
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("path contains invalid UTF-8 characters", line: 0, column: 0)', /rustc/a5a775e3f9e8043dad405e00aee0ae60882a7b71/src/tools/cargo/src/cargo/core/shell.rs:346:51
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After:

    λ cd \Xff/foo/ && $cargo verify-project && $cargo metadata
    {"success":"true"}
    warning: please specify `--format-version` flag explicitly to avoid compatibility problems
    error: path contains invalid UTF-8 characters

I am pretty  sure that this has zero real-world impact, but the diff is
small, so why not handle it?
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Mar 2, 2021

📌 Commit dd5806d has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2021
@bors
Copy link
Contributor

bors commented Mar 2, 2021

⌛ Testing commit dd5806d with merge c68432f...

@bors
Copy link
Contributor

bors commented Mar 2, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing c68432f to master...

@bors bors merged commit c68432f into rust-lang:master Mar 2, 2021
@matklad matklad deleted the utf8everywhere branch March 2, 2021 19:42
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 3, 2021
Update cargo

12 commits in 572e201536dc2e4920346e28037b63c0f4d88b3c..c68432f1e5cbbc09833699a951b1b5b059651dff
2021-02-24 16:51:20 +0000 to 2021-03-02 18:26:29 +0000
- Don't panic when printing JSON with non-utf8 paths (rust-lang/cargo#9226)
- Detect changes for JSON spec targets. (rust-lang/cargo#9223)
- Fix `cargo_target_empty_cfg` test with env var. (rust-lang/cargo#9225)
- Correct default cargo new edition (rust-lang/cargo#9202)
- Update split-debuginfo docs around the default. (rust-lang/cargo#9224)
- Minor update to registry API error messages. (rust-lang/cargo#9213)
- Some minor code cleanup. (rust-lang/cargo#9214)
- doc: Fix spelling worksapce->workspace (rust-lang/cargo#9212)
- Update SPDX version in docs. (rust-lang/cargo#9209)
- Throw error if CARGO_TARGET_DIR is an empty string (rust-lang/cargo#8939)
- testsuite: Use split debuginfo on macos. (rust-lang/cargo#9207)
- testsuite: Improve performance when using rustup. (rust-lang/cargo#9206)
@ehuss ehuss added this to the 1.52.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants