Skip to content

fix some issues with locale (replace "LANGUAGE" with "LC_ALL")#2447

Merged
sylvestre merged 1 commit intouutils:masterfrom
jhscheer:locale_c
Jun 23, 2021
Merged

fix some issues with locale (replace "LANGUAGE" with "LC_ALL")#2447
sylvestre merged 1 commit intouutils:masterfrom
jhscheer:locale_c

Conversation

@jhscheer
Copy link
Contributor

My understanding is that, as long as uutils does not support locales, we try to stick to the C locale.

However, a conversation #2361 (comment) with @tertsdiepraam made me aware that LANGUAGE=C is not enough and that LC_ALL=C is needed as the environment variable that overrides all the other localization settings.

e.g.

$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user

This PR does:

  • replace LANGUAGE with LC_ALL as environment variable in the tests
  • fix the the date string of affected uutils
  • replace and with '

@sylvestre
Copy link
Contributor

Seems that this change is failing on mac:


run: /Users/runner/work/coreutils/coreutils/target/debug/coreutils who -u
current_directory_resolved: 
run: gwho -u
actual: "runner   console      Jun 23 06:37 00:34         196\n"
expect: "runner   console      Jun 23 06:37  old          196\n"
---- test_who::test_users stderr ----
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `["runner", "console", "Jun", "23", "00:34", "196"]`,
 right: `["runner", "console", "Jun", "23", "old", "196"]`', /Users/runner/work/coreutils/coreutils/tests/by-util/test_who.rs:170:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    test_who::test_users

`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
@sylvestre sylvestre merged commit 87eaf6e into uutils:master Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants