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
try_verify_against_date_command_format
fail when LANG
is set to other locale
#1060
Comments
Does #1058 fix this? |
i found it when testing #1058 locally. in my guess the error happens because the date binary uses LANG env, which this test does not set explicitly. |
@scarf005 can you post or link to the testing source code? |
@jtmoon79 could you clarify? if you meant which test is failing: https://github.com/chronotope/chrono/blob/9dfa7b0028123ec3c728487443e8431adb4dc1e7/tests/dateutils.rs#L124-L139 |
Ah okay, I misunderstood that this was your own extra test you added. Thanks for the link. |
@scarf005 what happens if you run these three commands. (I'm pretty sure the same crash. I want to verify my understanding of when
Would you please copy+paste the console output? |
@jtmoon79 sure. I've also updated issue body to be more descriptive. with `LANG=ko_KR.UTF-8`
with `LANG=c`scarf@TG02: running 1 test test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.14s scarf@TG02:~/repo/chrono$ while it could be solved by setting its env explicitly, but would it suffice to set its env explicitly to |
This is a good fix. Here is an off-hand idea for anyone to pick-up (not required for this Issue):
|
Fails for me too using
|
Fixed in #1089. |
Summary
GNU
date
uses environment variableLANG
to localize its input, howevertry_verify_against_date_command_format
does not explicitly setLANG
, which makes the test fail whendate
is set to another locale.Reproduction
(asked in #1060 (comment))
with `LANG=ko_KR.UTF-8`
with `LANG=c`
scarf@TG02:
/repo/chrono$ export LANG=c/repo/chrono$ datescarf@TG02:
Sun May 28 13:06:42 KST 2023
scarf@TG02:~/repo/chrono$ cargo test --package chrono --test dateutils --features unstable-locales -- try_verify_against_date_command_format --exact --nocapture
Finished test [unoptimized + debuginfo] target(s) in 0.03s
Running tests/dateutils.rs (target/debug/deps/dateutils-917f84c226dfcdb1)
running 1 test
test try_verify_against_date_command_format ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.14s
scarf@TG02:~/repo/chrono$
Details
Error log
The text was updated successfully, but these errors were encountered: