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

iconv::iconv_no_flag_data_input test fails on Linux #336

Open
jgarzik opened this issue Oct 14, 2024 · 4 comments
Open

iconv::iconv_no_flag_data_input test fails on Linux #336

jgarzik opened this issue Oct 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jgarzik
Copy link
Contributor

jgarzik commented Oct 14, 2024

The iconv::iconv_no_flag_data_input test works in CI and on local MacOS, but fails on Ubuntu Linux LTS local testing:

---- iconv::iconv_no_flag_data_input stdout ----
thread 'iconv::iconv_no_flag_data_input' panicked at plib/src/testing.rs:99:5:
assertion `left == right` failed
  left: []
 right: [72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
   2: core::panicking::assert_failed_inner
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:410:17
   3: core::panicking::assert_failed
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:365:5
   4: plib::testing::run_test_u8
             at /home/jgarzik/repo/posixutils-rs/plib/src/testing.rs:99:5
   5: i18n_tests::iconv::iconv_test
             at ./tests/iconv/mod.rs:18:5
   6: i18n_tests::iconv::iconv_no_flag_data_input
             at ./tests/iconv/mod.rs:31:5
   7: i18n_tests::iconv::iconv_no_flag_data_input::{{closure}}
             at ./tests/iconv/mod.rs:29:30
   8: core::ops::function::FnOnce::call_once
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
   9: core::ops::function::FnOnce::call_once
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    iconv::iconv_no_flag_data_input

test result: FAILED. 34 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.18s

cc @rishadbaniya

@jgarzik jgarzik added the bug Something isn't working label Oct 14, 2024
@rishadbaniya
Copy link
Contributor

thats interesting, i'll take a look into this

@rishadbaniya
Copy link
Contributor

btw @jgarzik what's the default locale in the tested machine?

@jgarzik
Copy link
Contributor Author

jgarzik commented Oct 14, 2024

btw @jgarzik what's the default locale in the tested machine?

How to display the default locale? Here's some info, LMK if this is not sufficient,

$ locale -a
C
C.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US
en_US.iso88591
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX

$ locale
LANG=en_US
LANGUAGE=
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=

@rishadbaniya
Copy link
Contributor

rishadbaniya commented Oct 14, 2024

ah..i see that's interesting..
usually this LANG contains the default locale information (including the default encoding as well)
in arch machine it looks like this

LANG=en_US.UTF-8
LC_CTYPE=
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

and i used the LANG environment variable to get that encoding in the iconv binary, and in the no flag test the iconv uses that environment variable to get the encoding information

It seems i didn't realize the locale information might not give "encoding" information
or i'm missing something..i'll do some research on this...and send a PR fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants