-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Remove lossy OS string conversions #9337
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
base: main
Are you sure you want to change the base?
Conversation
This comes up a lot for quoted strings in messages: OS strings can be quoted directly and this prevents information loss. This commit removes ~60% of the calls to these methods (modulo tests). Some of the remaining calls are benign, for example because they convert solely to check for the presence of ASCII characters. Others are nontrivial to improve.
CodSpeed Performance ReportMerging #9337 will degrade performances by 4.85%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
GNU testsuite comparison: |
|
Seems that some are not. Unnecessary |
Part of the error message was left out due to a misreading of tests/chmod/no-x's output. It filters out this part for the sake of normalization between different tools.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Should be good now. The problem was error message formatting, not the sanitization. |
This PR removes most of the unnecessary lossy OS string conversions (
Path::display(),.to_string_lossy()). There are many more left but this gets the low-hanging fruit.Most of these conversions happened for formatted messages. This is unnecessary because
.quote()/.maybe_quote()can already handle OS strings. Sometimes those methods weren't used yet even though they should be so I added them (and removed manual quotation from the translations).I also applied
OsWrite/println_verbatimin a few places where we need to write unformatted OS strings to stdout. See c804e51.