Thread: So, what locale should the regression tests run in?

So, what locale should the regression tests run in?

From
Peter Eisentraut
Date:
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


Re: So, what locale should the regression tests run in?

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> 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?

Has this been resolved?

---------------------------------------------------------------------------


> 
> 
> 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
> 
> -- 
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: So, what locale should the regression tests run in?

From
Peter Eisentraut
Date:
Bruce Momjian wrote:
> Peter Eisentraut wrote:
>> 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?
> 
> Has this been resolved?

Since nobody spoke up, I have changed it now so it runs with locale by 
default.  Let's see if we get away with that.



Re: So, what locale should the regression tests run in?

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> Bruce Momjian wrote:
>> Has this been resolved?

> Since nobody spoke up, I have changed it now so it runs with locale by 
> default.  Let's see if we get away with that.

Buildfarm member "heron" doesn't like it, for one.
        regards, tom lane