Skip to content

extra::time: test failure on Win32 non-English locale #9418

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
klutzy opened this issue Sep 23, 2013 · 1 comment · Fixed by #9812
Closed

extra::time: test failure on Win32 non-English locale #9418

klutzy opened this issue Sep 23, 2013 · 1 comment · Fixed by #9812
Labels
O-windows Operating system: Windows

Comments

@klutzy
Copy link
Contributor

klutzy commented Sep 23, 2013

libextra/time.rs has #[test] fn run_tests(), which fails on my machine (win8.1, korean locale):

task <unnamed> failed at 'assertion failed: (w != 0)', C:\home\stone\rust\src\libstd\str.rs:2052

It is because rust_localtime function in rt/rust_builtin.cpp uses

    if (strftime(buffer, sizeof(buffer), "%Z", &tm) > 0) { ... }

but it returns ANSI string rather than utf-8, so assertion failed at str.
In my machine buffer gets '\xb4\xeb\xc7\xd1\xb9\xce\xb1\xb9 \xc7\xa5\xc1\xd8\xbd\xc3', "대한민국 표준시" in CP949.

It is fixable by using wcsftime which returns utf-16. I'll try it.

@thestinger
Copy link
Contributor

I'm pretty sure this stuff in thread-unsafe on Windows too...

bors added a commit that referenced this issue Oct 18, 2013
This fixes #9418 and #9618, and potential problems related to directory walking.
@bors bors closed this as completed in 69860b7 Oct 20, 2013
klutzy added a commit to klutzy/rust that referenced this issue Nov 5, 2013
Previously rust-lang#9418 fixed utf-8 assertion issue by wcsftime,
but the function didn't work as expected: it follows the locale
set by setlocale(), not the system code page.
This patch fixes it by manual multibyte-to-unicode conversion.
bors added a commit that referenced this issue Nov 8, 2013
Previously #9418 fixed utf-8 assertion issue by wcsftime,
but the function didn't work as expected: it follows the locale
set by setlocale(), not the system code page.
This patch fixes it by manual multibyte-to-unicode conversion.
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 9, 2022
Fix `mut_mutex_lock` when Mutex is behind immutable deref

I *think* the problem here is the `if let ty::Ref(_, _, Mutability::Mut) = cx.typeck_results().expr_ty(recv).kind()` line tries to check if the `Mutex` can be mutably borrowed (there already is a test for `Arc<Mutex<_>>`), but gets bamboozled by the `&mut Arc` indirection. And I *think* checking the deref-adjustment to filter immutable-adjust (the deref through the `Arc`, starting from `&mut Arc`) is the correct fix.

Fixes rust-lang#9415

changelog: Fix `mut_mutex_lock` when Mutex is behind immutable deref
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants