-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Panic in std #127563
Comments
You are using a nightly that is over half a year old. Try using the latest nightly to see if it reproduces. If it does, please set |
Based on my testing, the latest version also has this issue. |
It would appear that your libc's |
Can you share some of your system config, especially your locale? gai_strerror returning invalid UTF-8 is certainly not something expected by std. |
Which Chinese locale exactly? Could you show the values of the |
Sorry, the environment is no longer available, but it seems that using unwrap in net.rs:50:76 is too risky. |
It's probably not a UTF-8 locale. I would really recommend changing your locale to a UTF-8 one if possible, then this should work again. rust/library/std/src/sys/pal/unix/os.rs Lines 135 to 137 in b215beb
|
Deal with invalid UTF-8 from `gai_strerror` When the system is using a non-UTF-8 locale, the value will indeed not be UTF-8. That sucks for everyone involved, but is no reason for panic. We can "handle" this gracefully by just using from lossy, replacing the invalid UTF-8 with � and keeping the accidentally valid UTF-8. Good luck when debugging, but at least it's not a crash. We already do this for `strerror_r`. fixes rust-lang#127563
Deal with invalid UTF-8 from `gai_strerror` When the system is using a non-UTF-8 locale, the value will indeed not be UTF-8. That sucks for everyone involved, but is no reason for panic. We can "handle" this gracefully by just using from lossy, replacing the invalid UTF-8 with � and keeping the accidentally valid UTF-8. Good luck when debugging, but at least it's not a crash. We already do this for `strerror_r`. fixes rust-lang#127563
Rollup merge of rust-lang#127583 - Nilstrieb:invalid-utf8, r=joboet Deal with invalid UTF-8 from `gai_strerror` When the system is using a non-UTF-8 locale, the value will indeed not be UTF-8. That sucks for everyone involved, but is no reason for panic. We can "handle" this gracefully by just using from lossy, replacing the invalid UTF-8 with � and keeping the accidentally valid UTF-8. Good luck when debugging, but at least it's not a crash. We already do this for `strerror_r`. fixes rust-lang#127563
version: nightly-2023-11-22
os: centos-7
panic:
thread '' panicked at library/std/src/sys/unix/net.rs:50:76:
called
Result::unwrap()
on anErr
value: Utf8Error { valid_up_to: 4, error_len: Some(1) }note: run with
RUST_BACKTRACE=1
environment variable to display a backtracethread '' panicked at library/std/src/sys/unix/net.rs:50:76:
called
Result::unwrap()
on anErr
value: Utf8Error { valid_up_to: 4, error_len: Some(1) }thread '' panicked at library/std/src/sys/unix/net.rs:50:76:
called
Result::unwrap()
on anErr
value: Utf8Error { valid_up_to: 4, error_len: Some(1) }thread '' panicked at library/std/src/sys/unix/net.rs:50:76:
called
Result::unwrap()
on anErr
value: Utf8Error { valid_up_to: 4, error_len: Some(1) }The text was updated successfully, but these errors were encountered: