So, what locale should the regression tests run in?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: So, what locale should the regression tests run in?
Date: 2009-01-13 22:29:39
Message-ID: 200901140029.40264.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While regress/GNUmakefile appears to make an effort to run the regressions
tests with or without locale depending on the users choice, .e.g.,

# locale
NOLOCALE =
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif

the pg_regress.c implementation spoils that completely by unconditionally
unsetting all locale-related environment variables before initdb. One part
of the code doesn't know what the other is doing here.

To make it work as designed in GNUmakefile, the patch below would have to
be applied.

This leaves the question, what should really be the default behavior?

diff -u -3 -p -r1.57 pg_regress.c
--- src/test/regress/pg_regress.c 8 Jan 2009 20:09:06 -0000 1.57
+++ src/test/regress/pg_regress.c 13 Jan 2009 21:53:07 -0000
@@ -689,19 +689,22 @@ initialize_environment(void)
/*
* Clear out any non-C locale settings
*/
- unsetenv("LC_COLLATE");
- unsetenv("LC_CTYPE");
- unsetenv("LC_MONETARY");
- unsetenv("LC_MESSAGES");
- unsetenv("LC_NUMERIC");
- unsetenv("LC_TIME");
- unsetenv("LC_ALL");
- unsetenv("LANG");
- unsetenv("LANGUAGE");
- /* On Windows the default locale cannot be English, so force it */
+ if (nolocale)
+ {
+ unsetenv("LC_COLLATE");
+ unsetenv("LC_CTYPE");
+ unsetenv("LC_MONETARY");
+ unsetenv("LC_MESSAGES");
+ unsetenv("LC_NUMERIC");
+ unsetenv("LC_TIME");
+ unsetenv("LC_ALL");
+ unsetenv("LANG");
+ unsetenv("LANGUAGE");
+ /* On Windows the default locale cannot be English, so force it */
#if defined(WIN32) || defined(__CYGWIN__)
- putenv("LANG=en");
+ putenv("LANG=en");
#endif
+ }

/*
* Set multibyte as requested

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-01-13 22:36:08 Re: A single escape required for log_filename
Previous Message Stephen Frost 2009-01-13 22:18:43 Re: A single escape required for log_filename