* [PATCH] t/lib-httpd: pass LANG to Apache
@ 2022-10-04 17:42 René Scharfe
2022-10-05 19:50 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: René Scharfe @ 2022-10-04 17:42 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Jiang Xin, Jeff King
t5411 starts a web server with no explicit language setting, so it uses
the system default. Ten of its tests expect it to return error messages
containing the prefix "fatal: ", emitted by die(). This prefix can be
localized since a1fd2cf8cd (i18n: mark message helpers prefix for
translation, 2022-06-21), however. As a result these ten tests break
for me on a system with LANG="de_DE.UTF-8" because the web server sends
localized messages with "Schwerwiegend: " instead of "fatal: ".
Fix these tests by passing LANG to the web server, which is set to "C"
by t/test-lib.sh, to get untranslated messages on both sides.
Signed-off-by: René Scharfe <l.s.r@web.de>
---
t/lib-httpd/apache.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 497b9b9d92..1e2295a7cb 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -80,6 +80,7 @@ PassEnv LSAN_OPTIONS
PassEnv GIT_TRACE
PassEnv GIT_CONFIG_NOSYSTEM
PassEnv GIT_TEST_SIDEBAND_ALL
+PassEnv LANG
Alias /dumb/ www/
Alias /auth/dumb/ www/auth/dumb/
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] t/lib-httpd: pass LANG to Apache
2022-10-04 17:42 [PATCH] t/lib-httpd: pass LANG to Apache René Scharfe
@ 2022-10-05 19:50 ` Junio C Hamano
2022-10-05 21:20 ` Jeff King
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2022-10-05 19:50 UTC (permalink / raw)
To: René Scharfe; +Cc: Git List, Jiang Xin, Jeff King
René Scharfe <l.s.r@web.de> writes:
> t5411 starts a web server with no explicit language setting, so it uses
> the system default. Ten of its tests expect it to return error messages
> containing the prefix "fatal: ", emitted by die(). This prefix can be
> localized since a1fd2cf8cd (i18n: mark message helpers prefix for
> translation, 2022-06-21), however. As a result these ten tests break
> for me on a system with LANG="de_DE.UTF-8" because the web server sends
> localized messages with "Schwerwiegend: " instead of "fatal: ".
>
> Fix these tests by passing LANG to the web server, which is set to "C"
> by t/test-lib.sh, to get untranslated messages on both sides.
It is a good thing to do, but we seem to be extra conservative and
set both LC_ALL=C LANG=C (presumably by following the habit acquired
back when locale support were being introduced to various systems
with different degree, which way predates Git itself) and export
them in the main part of the test framework.
Shouldn't we be doing the same here?
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
> t/lib-httpd/apache.conf | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
> index 497b9b9d92..1e2295a7cb 100644
> --- a/t/lib-httpd/apache.conf
> +++ b/t/lib-httpd/apache.conf
> @@ -80,6 +80,7 @@ PassEnv LSAN_OPTIONS
> PassEnv GIT_TRACE
> PassEnv GIT_CONFIG_NOSYSTEM
> PassEnv GIT_TEST_SIDEBAND_ALL
> +PassEnv LANG
>
> Alias /dumb/ www/
> Alias /auth/dumb/ www/auth/dumb/
> --
> 2.37.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] t/lib-httpd: pass LANG to Apache
2022-10-05 19:50 ` Junio C Hamano
@ 2022-10-05 21:20 ` Jeff King
2022-10-06 15:33 ` [PATCH v2] t/lib-httpd: pass LANG and LC_ALL " René Scharfe
2022-10-06 16:20 ` [PATCH] t/lib-httpd: pass LANG " Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Jeff King @ 2022-10-05 21:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: René Scharfe, Git List, Jiang Xin
On Wed, Oct 05, 2022 at 12:50:53PM -0700, Junio C Hamano wrote:
> René Scharfe <l.s.r@web.de> writes:
>
> > t5411 starts a web server with no explicit language setting, so it uses
> > the system default. Ten of its tests expect it to return error messages
> > containing the prefix "fatal: ", emitted by die(). This prefix can be
> > localized since a1fd2cf8cd (i18n: mark message helpers prefix for
> > translation, 2022-06-21), however. As a result these ten tests break
> > for me on a system with LANG="de_DE.UTF-8" because the web server sends
> > localized messages with "Schwerwiegend: " instead of "fatal: ".
> >
> > Fix these tests by passing LANG to the web server, which is set to "C"
> > by t/test-lib.sh, to get untranslated messages on both sides.
>
> It is a good thing to do, but we seem to be extra conservative and
> set both LC_ALL=C LANG=C (presumably by following the habit acquired
> back when locale support were being introduced to various systems
> with different degree, which way predates Git itself) and export
> them in the main part of the test framework.
>
> Shouldn't we be doing the same here?
I think setting both probably is overkill. But if we are going to set
one, the important one is LC_ALL. It overrides specific LC_* variables,
which in turn override LANG. So just setting LANG would get confused if
LC_MESSAGES were set, for example.
That said, there probably is no downside to passing through both, so we
might as well do so.
Other than that, the patch is obviously the right thing to be doing. I'm
surprised it took this long for it to be a problem. ;)
-Peff
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] t/lib-httpd: pass LANG and LC_ALL to Apache
2022-10-05 21:20 ` Jeff King
@ 2022-10-06 15:33 ` René Scharfe
2022-10-06 16:20 ` [PATCH] t/lib-httpd: pass LANG " Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: René Scharfe @ 2022-10-06 15:33 UTC (permalink / raw)
To: Jeff King, Junio C Hamano; +Cc: Git List, Jiang Xin
t5411 starts a web server with no explicit language setting, so it uses
the system default. Ten of its tests expect it to return error messages
containing the prefix "fatal: ", emitted by die(). This prefix can be
localized since a1fd2cf8cd (i18n: mark message helpers prefix for
translation, 2022-06-21), however. As a result these ten tests break
for me on a system with LANG="de_DE.UTF-8" because the web server sends
localized messages with "Schwerwiegend: " instead of "fatal: ".
Fix these tests by passing LANG and LC_ALL to the web server, which are
set to "C" by t/test-lib.sh, to get untranslated messages on both sides.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
---
Thank you, forgot that LC_* exists..
t/lib-httpd/apache.conf | 2 ++
1 file changed, 2 insertions(+)
diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 497b9b9d92..706799391b 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -80,6 +80,8 @@ PassEnv LSAN_OPTIONS
PassEnv GIT_TRACE
PassEnv GIT_CONFIG_NOSYSTEM
PassEnv GIT_TEST_SIDEBAND_ALL
+PassEnv LANG
+PassEnv LC_ALL
Alias /dumb/ www/
Alias /auth/dumb/ www/auth/dumb/
--
2.38.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] t/lib-httpd: pass LANG to Apache
2022-10-05 21:20 ` Jeff King
2022-10-06 15:33 ` [PATCH v2] t/lib-httpd: pass LANG and LC_ALL " René Scharfe
@ 2022-10-06 16:20 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2022-10-06 16:20 UTC (permalink / raw)
To: Jeff King; +Cc: René Scharfe, Git List, Jiang Xin
Jeff King <peff@peff.net> writes:
>> Shouldn't we be doing the same here?
>
> I think setting both probably is overkill. But if we are going to set
> one, the important one is LC_ALL. It overrides specific LC_* variables,
> which in turn override LANG. So just setting LANG would get confused if
> LC_MESSAGES were set, for example.
>
> That said, there probably is no downside to passing through both, so we
> might as well do so.
Yup. I suspect that the habit dates back to before LC_* was widespread
and some platforms needed LANG. On modern systems that understand i18n
and do not need to set NO_GETTEXT, forcing LC_ALL should be sufficient.
> Other than that, the patch is obviously the right thing to be doing. I'm
> surprised it took this long for it to be a problem. ;)
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-06 16:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 17:42 [PATCH] t/lib-httpd: pass LANG to Apache René Scharfe
2022-10-05 19:50 ` Junio C Hamano
2022-10-05 21:20 ` Jeff King
2022-10-06 15:33 ` [PATCH v2] t/lib-httpd: pass LANG and LC_ALL " René Scharfe
2022-10-06 16:20 ` [PATCH] t/lib-httpd: pass LANG " Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).