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

Corrupted data trashes the output #127868

Closed
jarkkojs opened this issue Jul 17, 2024 · 8 comments · Fixed by #127955
Closed

Corrupted data trashes the output #127868

jarkkojs opened this issue Jul 17, 2024 · 8 comments · Fixed by #127955
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jarkkojs
Copy link

In my Fedora installation /home/jarkko/.cargo/registry/src/index.crates.io-6f17d22bba15001f/vm-memory-0.14.1/src/lib.rs ended up being a corrupted file.

It took me hours to realize, given that the output does not bring any clarity to it. rustc should really have ratelimit detection or something to detect corrupted file instead and inform about this to the user.

Screenshot from 2024-07-17 17-04-06

@jarkkojs jarkkojs added the C-bug Category: This is a bug. label Jul 17, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 17, 2024
@Urgau
Copy link
Member

Urgau commented Jul 17, 2024

This indeed seems quite confusing; and counter-productive to try to show this blob of errors.

Would you be able to provide us with a reproducible example of the issue? Or if you still have it the corrupted file.

@rustbot labels +T-compiler +A-diagnostics +D-verbose +D-confusing +S-needs-repro -needs-triage

@rustbot rustbot added A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jul 17, 2024
@jarkkojs
Copy link
Author

This indeed seems quite confusing; and counter-productive to try to show this blob of errors.

Would you be able to provide us with a reproducible example of the issue? Or if you still have it the corrupted file.

@rustbot labels +T-compiler +A-diagnostics +D-verbose +D-confusing +S-needs-repro -needs-triage

So this a problem because I unfortunately deleted the trashed file before someone told me that I should report this as a bug. I regret that I did not store it :-/

BUT I recalled that it was probably for reason a long string of ANSI escape codes. So I did a test string:

\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)

This creates somewhat similar output as I got, except probably the string was a bit longer in my case.

@jarkkojs
Copy link
Author

OK doubling that starts to be almost perfect match:

\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)\1\e[38;5;015m\2uu\1\e[0m\2\1\e[38;2;191;254;33m\2(ins)

@jarkkojs
Copy link
Author

jarkkojs commented Jul 17, 2024

Screenshot from 2024-07-17 22-57-28

... I'm considering T-shirt design ;-) Made by me and rustc.

EDIT: and rendered by excellent terminal emulator foot https://codeberg.org/dnkl/foot

@jarkkojs
Copy link
Author

Somehow rustc should be able to detect corrupted file in cargo's source repository (or whatever it is called). It was pretty bizarre sight when I encountered this by accident.

@Urgau
Copy link
Member

Urgau commented Jul 17, 2024

Thanks for the repro.
@rustbot label -S-needs-repro

@rustbot rustbot removed the S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. label Jul 17, 2024
@jarkkojs
Copy link
Author

Yeah I mean it is really a huge corner case but it can happen in the case of data corruption (e.g. power outage in middle of write operation). I'd detect frequency of errors and maybe a threshold parameter when it is interpreted as corruption with a sane default value.

@chenyukang chenyukang self-assigned this Jul 19, 2024
@chenyukang
Copy link
Member

yeah, I believe this error comes out from the phase of lexing, which rustc are trying to find all the mismatched delimiters, maybe a threshold is ok for resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants