Bug 1025 - tests fail when run with non-english locale
tests fail when run with non-english locale
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.9.10
PC Linux
: low low
Assigned To: Todd C. Miller
https://salsa.debian.org/sudo-team/su...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-03-14 13:22 MDT by Marc Haber
Modified: 2022-06-06 13:10 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Haber 2022-03-14 13:22:52 MDT
Hi,

the Debian Salsa Continuous Integration contains a test pipeline where the sudo is built with some random locale activated. If a locale is chosen that is non-english, sudo's tests fail since they expect english output, and sudo is translated to many languages.

I opened an issue with the pipeline maintainers and got the advice listed at https://salsa.debian.org/salsa-ci-team/pipeline/-/issues/242, basically saying that sudo's tests should not blindly assume that the tests are run in an English environment, and adjust it's assertions accordingly (as in: translate the reference messages before comparing them). I do not have a clue how easy it would be to "just" gettext in the test suite, also calling up the translations when comparing output, but maybe it is an acceptable workaround to just explicitly set an English locale when running the tests.

Greetings
Marc

P.S.: If the two links to salsa.debian.org only work when logged in, let me know and I'll copy the relevant texts.
Comment 1 Todd C. Miller 2022-03-14 13:52:43 MDT
The "make check" target sets LC_ALL to either C.UTF-8 (if available) or C and unsets LANG before running the test programs so I thought I had this handled.

Running:

env LANG=fr_FR.UTF-8 make check

passes with no errors.

Looking at the raw output from the pipeline I see that it is setting LANGUAGE, which overrides LC_ALL.  I've updated the check: target in the Makefiles to unset LANGUAGE too.  With that change, the tests pass even when LANGUAGE is set to a non-English locale.

https://www.sudo.ws/repos/sudo/rev/87573102f25b
Comment 2 Marc Haber 2022-03-15 01:54:52 MDT
I revisited the issue this morning to reinvestigate, came up with the LANGUAGE result, just to find that you solved the issue while I was sleeping. Thank you very much! It is a pleasure packaging your software.
Comment 3 Todd C. Miller 2022-06-06 13:10:42 MDT
Fixed in sudo 1.9.11, which is available now.