On 09/ 8/12 10:02 AM, Danek Duvall wrote:
Erik Trauschke wrote:

This is a quick fix for 7194691 which might save people, who don't know
about the unwritten rule of running the test suite under locale C, some
time.

So the idea of printing a warning is fine for the kind of problem that
7194691 is talking about, where a date string is printed in a different
format, changing the output of a command, and causing a test to fail.  I
don't think that's a problem that calls for skipping the test.  Creating a
mechanism that causes a test to be run in a specific locale would be nice,
but not, I think, necessary here.

But locale control is more finely-grained than just LC_ALL and LANG.  The
specific date string problem in 7194691 is controlled by LC_TIME as well,
and in another message in this thread, you talk about a message that's
translated when it shouldn't be (for the purposes of the test), which is
controlled by LC_MESSAGES.  And I frequently see people get screwed up by
LC_COLLATE.  I doubt LC_MONETARY or LC_NUMERIC would be problems, though.

I will run some tests with these set to some other locales and see what comes up.


So your test should probably be a bit more comprehensive.  And they can
probably be combined into one if statement:

     if os.environ.get("LC_ALL", "C") != "C" or \
         os.environ.get("LC_TIME", "C") != "C" or ...

According to this http://pubs.opengroup.org/onlinepubs/007908799/xbd/envvar.html:

---
LC_ALL
This variable determines the values for all locale categories. The value of the LC_ALL environment variable has precedence over any of the other environment variables starting with LC_ (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and the LANG environment variable.
---

Unless I'm reading this wrong, if you set LC_ALL, the setting of any other LC_ variables should not matter. So I think I should be good by adding another elif statement testing for LC_TIME:

if "LC_ALL" in os.environ and os.environ["LC_ALL"] != "C":
    print_lc_warn()
elif "LC_TIME" in os.environ and if os.environ["LC_TIME"] != "C":
    print_lc_warn()
elif "LANG" in os.environ and if os.environ["LANG"] != "C":
    print_lc_warn()

I think that should be the correct sequence.

Erik





Danek
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to