{"thread":{"id":"58565","subject":"[PATCH] t/lib-httpd: pass LANG to Apache","startedAt":"2022-10-04T17:42:58Z","lastAt":"2022-10-06T16:21:01Z","messageCount":5,"participants":["René Scharfe","Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"464204","messageId":"3b370f7b-df84-0629-d334-aa9dfbca1c05@web.de","threadId":"58565","inReplyTo":null,"subject":"[PATCH] t/lib-httpd: pass LANG to Apache","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2022-10-04T17:42:39Z","receivedAt":"2022-10-04T17:42:58Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"t5411 starts a web server with no explicit language setting, so it uses\nthe system default.  Ten of its tests expect it to return error messages\ncontaining the prefix \"fatal: \", emitted by die().  This prefix can be\nlocalized since a1fd2cf8cd (i18n: mark message helpers prefix for\ntranslation, 2022-06-21), however.  As a result these ten tests break\nfor me on a system with LANG=\"de_DE.UTF-8\" because the web server sends\nlocalized messages with \"Schwerwiegend: \" instead of \"fatal: \".\n\nFix these tests by passing LANG to the web server, which is set to \"C\"\nby t/test-lib.sh, to get untranslated messages on both sides.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n t/lib-httpd/apache.conf | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\nindex 497b9b9d92..1e2295a7cb 100644\n--- a/t/lib-httpd/apache.conf\n+++ b/t/lib-httpd/apache.conf\n@@ -80,6 +80,7 @@ PassEnv LSAN_OPTIONS\n PassEnv GIT_TRACE\n PassEnv GIT_CONFIG_NOSYSTEM\n PassEnv GIT_TEST_SIDEBAND_ALL\n+PassEnv LANG\n\n Alias /dumb/ www/\n Alias /auth/dumb/ www/auth/dumb/\n--\n2.37.3\n"},{"id":"464257","messageId":"xmqqtu4inj6q.fsf@gitster.g","threadId":"58565","inReplyTo":"3b370f7b-df84-0629-d334-aa9dfbca1c05@web.de","subject":"Re: [PATCH] t/lib-httpd: pass LANG to Apache","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-10-05T19:50:53Z","receivedAt":"2022-10-05T19:50:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> t5411 starts a web server with no explicit language setting, so it uses\n> the system default.  Ten of its tests expect it to return error messages\n> containing the prefix \"fatal: \", emitted by die().  This prefix can be\n> localized since a1fd2cf8cd (i18n: mark message helpers prefix for\n> translation, 2022-06-21), however.  As a result these ten tests break\n> for me on a system with LANG=\"de_DE.UTF-8\" because the web server sends\n> localized messages with \"Schwerwiegend: \" instead of \"fatal: \".\n>\n> Fix these tests by passing LANG to the web server, which is set to \"C\"\n> by t/test-lib.sh, to get untranslated messages on both sides.\n\nIt is a good thing to do, but we seem to be extra conservative and\nset both LC_ALL=C LANG=C (presumably by following the habit acquired\nback when locale support were being introduced to various systems\nwith different degree, which way predates Git itself) and export\nthem in the main part of the test framework.\n\nShouldn't we be doing the same here?\n\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  t/lib-httpd/apache.conf | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\n> index 497b9b9d92..1e2295a7cb 100644\n> --- a/t/lib-httpd/apache.conf\n> +++ b/t/lib-httpd/apache.conf\n> @@ -80,6 +80,7 @@ PassEnv LSAN_OPTIONS\n>  PassEnv GIT_TRACE\n>  PassEnv GIT_CONFIG_NOSYSTEM\n>  PassEnv GIT_TEST_SIDEBAND_ALL\n> +PassEnv LANG\n>\n>  Alias /dumb/ www/\n>  Alias /auth/dumb/ www/auth/dumb/\n> --\n> 2.37.3\n"},{"id":"464261","messageId":"Yz31Lv+97z9p/0TK@coredump.intra.peff.net","threadId":"58565","inReplyTo":"xmqqtu4inj6q.fsf@gitster.g","subject":"Re: [PATCH] t/lib-httpd: pass LANG to Apache","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-10-05T21:20:46Z","receivedAt":"2022-10-05T21:20:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 05, 2022 at 12:50:53PM -0700, Junio C Hamano wrote:\n\n> René Scharfe <l.s.r@web.de> writes:\n> \n> > t5411 starts a web server with no explicit language setting, so it uses\n> > the system default.  Ten of its tests expect it to return error messages\n> > containing the prefix \"fatal: \", emitted by die().  This prefix can be\n> > localized since a1fd2cf8cd (i18n: mark message helpers prefix for\n> > translation, 2022-06-21), however.  As a result these ten tests break\n> > for me on a system with LANG=\"de_DE.UTF-8\" because the web server sends\n> > localized messages with \"Schwerwiegend: \" instead of \"fatal: \".\n> >\n> > Fix these tests by passing LANG to the web server, which is set to \"C\"\n> > by t/test-lib.sh, to get untranslated messages on both sides.\n> \n> It is a good thing to do, but we seem to be extra conservative and\n> set both LC_ALL=C LANG=C (presumably by following the habit acquired\n> back when locale support were being introduced to various systems\n> with different degree, which way predates Git itself) and export\n> them in the main part of the test framework.\n> \n> Shouldn't we be doing the same here?\n\nI think setting both probably is overkill. But if we are going to set\none, the important one is LC_ALL. It overrides specific LC_* variables,\nwhich in turn override LANG. So just setting LANG would get confused if\nLC_MESSAGES were set, for example.\n\nThat said, there probably is no downside to passing through both, so we\nmight as well do so.\n\nOther than that, the patch is obviously the right thing to be doing. I'm\nsurprised it took this long for it to be a problem. ;)\n\n-Peff\n"},{"id":"464297","messageId":"a1699375-c660-13ab-42fb-26a8afe4c376@web.de","threadId":"58565","inReplyTo":"Yz31Lv+97z9p/0TK@coredump.intra.peff.net","subject":"[PATCH v2] t/lib-httpd: pass LANG and LC_ALL to Apache","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2022-10-06T15:33:07Z","receivedAt":"2022-10-06T15:33:41Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"t5411 starts a web server with no explicit language setting, so it uses\nthe system default.  Ten of its tests expect it to return error messages\ncontaining the prefix \"fatal: \", emitted by die().  This prefix can be\nlocalized since a1fd2cf8cd (i18n: mark message helpers prefix for\ntranslation, 2022-06-21), however.  As a result these ten tests break\nfor me on a system with LANG=\"de_DE.UTF-8\" because the web server sends\nlocalized messages with \"Schwerwiegend: \" instead of \"fatal: \".\n\nFix these tests by passing LANG and LC_ALL to the web server, which are\nset to \"C\" by t/test-lib.sh, to get untranslated messages on both sides.\n\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nThank you, forgot that LC_* exists..\n\n t/lib-httpd/apache.conf | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\nindex 497b9b9d92..706799391b 100644\n--- a/t/lib-httpd/apache.conf\n+++ b/t/lib-httpd/apache.conf\n@@ -80,6 +80,8 @@ PassEnv LSAN_OPTIONS\n PassEnv GIT_TRACE\n PassEnv GIT_CONFIG_NOSYSTEM\n PassEnv GIT_TEST_SIDEBAND_ALL\n+PassEnv LANG\n+PassEnv LC_ALL\n\n Alias /dumb/ www/\n Alias /auth/dumb/ www/auth/dumb/\n--\n2.38.0\n"},{"id":"464306","messageId":"xmqqy1tsnct8.fsf@gitster.g","threadId":"58565","inReplyTo":"Yz31Lv+97z9p/0TK@coredump.intra.peff.net","subject":"Re: [PATCH] t/lib-httpd: pass LANG to Apache","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-10-06T16:20:51Z","receivedAt":"2022-10-06T16:21:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> Shouldn't we be doing the same here?\n>\n> I think setting both probably is overkill. But if we are going to set\n> one, the important one is LC_ALL. It overrides specific LC_* variables,\n> which in turn override LANG. So just setting LANG would get confused if\n> LC_MESSAGES were set, for example.\n>\n> That said, there probably is no downside to passing through both, so we\n> might as well do so.\n\nYup.  I suspect that the habit dates back to before LC_* was widespread\nand some platforms needed LANG.  On modern systems that understand i18n\nand do not need to set NO_GETTEXT, forcing LC_ALL should be sufficient.\n\n> Other than that, the patch is obviously the right thing to be doing. I'm\n> surprised it took this long for it to be a problem. ;)\n\nThanks.\n"}]}