{"thread":{"id":"38122","subject":"Accept-language test fails on Mac OS","startedAt":"2014-12-05T22:35:51Z","lastAt":"2014-12-08T15:51:39Z","messageCount":11,"participants":["Michael Blume","Junio C Hamano","Torsten Bögershausen","Yi, EungJun","Jeff King","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253197","messageId":"CAO2U3QgoSmYkDYbvFnChxPMrTCEboUbk1NWjv+9Us60EfozN_w@mail.gmail.com","threadId":"38122","inReplyTo":null,"subject":"Accept-language test fails on Mac OS","fromName":"Michael Blume","fromEmail":"blume.mike@gmail.com","sentAt":"2014-12-05T22:35:51Z","receivedAt":"2014-12-05T22:35:51Z","isPatch":false,"sender":{"key":"blume.mike@gmail.com","avatar":"https://gravatar.com/avatar/1a7b440e1d942425ff4098ac7fc15b86b30cecaa56e1692a7ef8b5939ba25ea7?d=mp&s=160"},"body":"Test #25 'git client sends Accept-Language based on LANGUAGE, LC_ALL,\nLC_MESSAGES and LANG' in t5550 fails consistently on my mac, and has\nsince the test was introduced. Test 26 and 27 ('git client sends\nAccept-Language with many preferred languages' and 'git client does\nnot send Accept-Language') seem fine.\n\nI'm building git with NO_GETTEXT=1, which may be an issue? But in that\ncase the test should probably be gated on gettext?\n"},{"id":"253201","messageId":"xmqqppbxogli.fsf@gitster.dls.corp.google.com","threadId":"38122","inReplyTo":"CAO2U3QgoSmYkDYbvFnChxPMrTCEboUbk1NWjv+9Us60EfozN_w@mail.gmail.com","subject":"Re: Accept-language test fails on Mac OS","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T22:51:37Z","receivedAt":"2014-12-05T22:51:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Blume <blume.mike@gmail.com> writes:\n\n> Test #25 'git client sends Accept-Language based on LANGUAGE, LC_ALL,\n> LC_MESSAGES and LANG' in t5550 fails consistently on my mac, and has\n> since the test was introduced. Test 26 and 27 ('git client sends\n> Accept-Language with many preferred languages' and 'git client does\n> not send Accept-Language') seem fine.\n>\n> I'm building git with NO_GETTEXT=1, which may be an issue? But in that\n> case the test should probably be gated on gettext?\n\nI recall queuing a SQUASH??? on top of the posted patch; does these\ntests pass with it reverted?\n"},{"id":"253203","messageId":"CAO2U3QikrHRC0PncO2vxFMv88HMnJHYa1AiPak+Lp0OU1u6dZA@mail.gmail.com","threadId":"38122","inReplyTo":"xmqqppbxogli.fsf@gitster.dls.corp.google.com","subject":"Re: Accept-language test fails on Mac OS","fromName":"Michael Blume","fromEmail":"blume.mike@gmail.com","sentAt":"2014-12-05T23:01:04Z","receivedAt":"2014-12-05T23:01:04Z","isPatch":false,"sender":{"key":"blume.mike@gmail.com","avatar":"https://gravatar.com/avatar/1a7b440e1d942425ff4098ac7fc15b86b30cecaa56e1692a7ef8b5939ba25ea7?d=mp&s=160"},"body":"On Fri, Dec 5, 2014 at 2:51 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Michael Blume <blume.mike@gmail.com> writes:\n>\n>> Test #25 'git client sends Accept-Language based on LANGUAGE, LC_ALL,\n>> LC_MESSAGES and LANG' in t5550 fails consistently on my mac, and has\n>> since the test was introduced. Test 26 and 27 ('git client sends\n>> Accept-Language with many preferred languages' and 'git client does\n>> not send Accept-Language') seem fine.\n>>\n>> I'm building git with NO_GETTEXT=1, which may be an issue? But in that\n>> case the test should probably be gated on gettext?\n>\n> I recall queuing a SQUASH??? on top of the posted patch; does these\n> tests pass with it reverted?\n\nThe test fails both on pu and on 7567fad which is prior to the\nSQUASH??? commit, so the squash does not seem to change anything.\n"},{"id":"253237","messageId":"5482D180.9010002@web.de","threadId":"38122","inReplyTo":"CAO2U3QikrHRC0PncO2vxFMv88HMnJHYa1AiPak+Lp0OU1u6dZA@mail.gmail.com","subject":"Re: Accept-language test fails on Mac OS","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-12-06T09:50:56Z","receivedAt":"2014-12-06T09:50:56Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2014-12-06 00.01, Michael Blume wrote:\n> On Fri, Dec 5, 2014 at 2:51 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Michael Blume <blume.mike@gmail.com> writes:\n>>\n>>> Test #25 'git client sends Accept-Language based on LANGUAGE, LC_ALL,\n>>> LC_MESSAGES and LANG' in t5550 fails consistently on my mac, and has\n>>> since the test was introduced. Test 26 and 27 ('git client sends\n>>> Accept-Language with many preferred languages' and 'git client does\n>>> not send Accept-Language') seem fine.\n>>>\n>>> I'm building git with NO_GETTEXT=1, which may be an issue? But in that\n>>> case the test should probably be gated on gettext?\n>>\n>> I recall queuing a SQUASH??? on top of the posted patch; does these\n>> tests pass with it reverted?\n> \n> The test fails both on pu and on 7567fad which is prior to the\n> SQUASH??? commit, so the squash does not seem to change anything.\npu@c83418638e0c326f:\nt5550 fails here under Debian Linux,\nI haven't digged further\n\nnot ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n#       \n#               check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n#       \n"},{"id":"253254","messageId":"CAFT+Tg_4EJ15CmujDtcubfw+0rr2J=pbjccqSSs9tmj-rz6+eQ@mail.gmail.com","threadId":"38122","inReplyTo":"5482D180.9010002@web.de","subject":"Re: Accept-language test fails on Mac OS","fromName":"Yi, EungJun","fromEmail":"semtlenori@gmail.com","sentAt":"2014-12-06T19:44:00Z","receivedAt":"2014-12-06T19:44:00Z","isPatch":false,"sender":{"key":"semtlenori@gmail.com","avatar":"https://gravatar.com/avatar/8363435d2badb3450df0dd7c4ec2113f6e1d62c44dd3cf7dfe83c5a389b8a9bf?d=mp&s=160"},"body":"Could you tell me your locale information from executing 'locale'\ncommand and the verbose message you can get by accessing any git\nrepository via HTTP protocol? (e.g. GIT_CURL_VERBOSE=1 git clone\nhttp://github.com/foo/bar )\n\nI think the failures are related with your locale information.\n\nOn Sat, Dec 6, 2014 at 6:50 PM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 2014-12-06 00.01, Michael Blume wrote:\n>> On Fri, Dec 5, 2014 at 2:51 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Michael Blume <blume.mike@gmail.com> writes:\n>>>\n>>>> Test #25 'git client sends Accept-Language based on LANGUAGE, LC_ALL,\n>>>> LC_MESSAGES and LANG' in t5550 fails consistently on my mac, and has\n>>>> since the test was introduced. Test 26 and 27 ('git client sends\n>>>> Accept-Language with many preferred languages' and 'git client does\n>>>> not send Accept-Language') seem fine.\n>>>>\n>>>> I'm building git with NO_GETTEXT=1, which may be an issue? But in that\n>>>> case the test should probably be gated on gettext?\n>>>\n>>> I recall queuing a SQUASH??? on top of the posted patch; does these\n>>> tests pass with it reverted?\n>>\n>> The test fails both on pu and on 7567fad which is prior to the\n>> SQUASH??? commit, so the squash does not seem to change anything.\n> pu@c83418638e0c326f:\n> t5550 fails here under Debian Linux,\n> I haven't digged further\n>\n> not ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n> #\n> #               check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n> #\n>\n"},{"id":"253256","messageId":"54836F46.9080009@web.de","threadId":"38122","inReplyTo":"CAFT+Tg_4EJ15CmujDtcubfw+0rr2J=pbjccqSSs9tmj-rz6+eQ@mail.gmail.com","subject":"Re: Accept-language test fails on Mac OS","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-12-06T21:04:06Z","receivedAt":"2014-12-06T21:04:06Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2014-12-06 20.44, Yi, EungJun wrote:\n> Could you tell me your locale information from executing 'locale'\n> command and the verbose message you can get by accessing any git\n> repository via HTTP protocol? (e.g. GIT_CURL_VERBOSE=1 git clone\n> http://github.com/foo/bar )\nlocale -a\nC\nC.UTF-8\nen_US.utf8\nicelandic\nis_IS\nis_IS.iso88591\nis_IS.utf8\nPOSIX\n\n-----------------------------\nAfter patching like this:\ndiff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh\nindex fc6e7fc..1e42b42 100755\n--- a/t/t5550-http-fetch-dumb.sh\n+++ b/t/t5550-http-fetch-dumb.sh\n@@ -205,8 +205,8 @@ check_language () {\n        LANG=$5 \\\n        git ls-remote \"$HTTPD_URL/dumb/repo.git\" 2>&1 |\n        tr -d '\\015' |\n-       sort -u >stderr &&\n-       grep -i ^Accept-Language: stderr >actual &&\n+       sort -u >stderr\n+       grep -i ^Accept-Language: stderr >actual\n        test_cmp expect actual\n }\n-----------\nI get this:\n\n\nexpecting success: \n        check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n        check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n        check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n        check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n\n--- expect      2014-12-06 21:00:59.000000000 +0000\n+++ actual      2014-12-06 21:00:59.000000000 +0000\n@@ -1 +0,0 @@\n-Accept-Language: de-DE, *;q=0.1\nnot ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n#       \n#               check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n#               check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n#       \n"},{"id":"253265","messageId":"CAFT+Tg_OQLj7oWfOJ8ATKHo36Jv3+JcSYWEc-trKsAtjv7wskg@mail.gmail.com","threadId":"38122","inReplyTo":"54836F46.9080009@web.de","subject":"Re: Accept-language test fails on Mac OS","fromName":"Yi, EungJun","fromEmail":"semtlenori@gmail.com","sentAt":"2014-12-07T06:54:39Z","receivedAt":"2014-12-07T06:54:39Z","isPatch":false,"sender":{"key":"semtlenori@gmail.com","avatar":"https://gravatar.com/avatar/8363435d2badb3450df0dd7c4ec2113f6e1d62c44dd3cf7dfe83c5a389b8a9bf?d=mp&s=160"},"body":"Thank you for providing useful information to fix the failures.\n\nOn Sun, Dec 7, 2014 at 6:04 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 2014-12-06 20.44, Yi, EungJun wrote:\n>> Could you tell me your locale information from executing 'locale'\n>> command and the verbose message you can get by accessing any git\n>> repository via HTTP protocol? (e.g. GIT_CURL_VERBOSE=1 git clone\n>> http://github.com/foo/bar )\n> locale -a\n> C\n> C.UTF-8\n> en_US.utf8\n> icelandic\n> is_IS\n> is_IS.iso88591\n> is_IS.utf8\n> POSIX\n\nI'm sorry for bothering you, but could you tell me the result of\n\"locale\" command without \"-a\" option? What I want to know is locale\nenvironment variables and its values, so I want to reproduce the test\nfailures on my laptop.\n\n>\n> -----------------------------\n> After patching like this:\n> diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh\n> index fc6e7fc..1e42b42 100755\n> --- a/t/t5550-http-fetch-dumb.sh\n> +++ b/t/t5550-http-fetch-dumb.sh\n> @@ -205,8 +205,8 @@ check_language () {\n>         LANG=$5 \\\n>         git ls-remote \"$HTTPD_URL/dumb/repo.git\" 2>&1 |\n>         tr -d '\\015' |\n> -       sort -u >stderr &&\n> -       grep -i ^Accept-Language: stderr >actual &&\n> +       sort -u >stderr\n> +       grep -i ^Accept-Language: stderr >actual\n>         test_cmp expect actual\n>  }\n> -----------\n> I get this:\n>\n>\n> expecting success:\n>         check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n>\n> --- expect      2014-12-06 21:00:59.000000000 +0000\n> +++ actual      2014-12-06 21:00:59.000000000 +0000\n> @@ -1 +0,0 @@\n> -Accept-Language: de-DE, *;q=0.1\n> not ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n> #\n> #               check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n> #               check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n> #\n>\n>\n\nThe test seems to fail if LANGUAGE=\"\". I will dig it. Thanks.\n"},{"id":"253266","messageId":"20141207071827.GA31014@peff.net","threadId":"38122","inReplyTo":"54836F46.9080009@web.de","subject":"Re: Accept-language test fails on Mac OS","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-12-07T07:18:28Z","receivedAt":"2014-12-07T07:18:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 06, 2014 at 10:04:06PM +0100, Torsten Bögershausen wrote:\n\n> I get this:\n> \n> \n> expecting success: \n>         check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n>         check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n> \n> --- expect      2014-12-06 21:00:59.000000000 +0000\n> +++ actual      2014-12-06 21:00:59.000000000 +0000\n> @@ -1 +0,0 @@\n> -Accept-Language: de-DE, *;q=0.1\n> not ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n\nI can reproduce the same problem here (Debian unstable). I actually ran\ninto three issues (aside from needing to use Junio's SQUASH commit, to\navoid the \"\\r\" bash-ism):\n\n  1. I couldn't build without including locale.h, for the\n     definition of setlocale() and the LC_MESSAGES constant (both used\n     in get_preferred_languages).\n\n     I'm not sure what portability issues there are with including it\n     unconditionally. Should this possibly be tied into gettext.c, which\n     already uses setlocale?\n\n  2. The call to setlocale(LC_MESSAGES, NULL) in get_preferred_languages\n     always returns \"C\" for me. This seems related to building with\n     NO_GETTEXT (which I typically do), as we never init setlocale\n     if NO_GETTEXT is set. This program demonstrates it:\n\n\t#include <stdio.h>\n\t#include <string.h>\n\t#include <locale.h>\n\t\n\tint main(int argc, char **argv)\n\t{\n\t\tif (argv[1] && !strcmp(argv[1], \"init\"))\n\t\t\tsetlocale(LC_MESSAGES, \"\");\n\t\tprintf(\"%s\", setlocale(LC_MESSAGES, NULL));\n\t\treturn 0;\n\t}\n\n     If I run it as \"LANG=en_US.UTF-8 ./a.out\", it prints \"C\". If I run\n     it as \"LANG=en_US.UTF-8 ./a.out init\", it prints \"en_US.UTF-8\". I\n     think we either need to start unconditionally calling setlocale()\n     as we do in git_setup_gettext, or we need to tie your feature to\n     using gettext.\n\n     This is what causes the failure of the de-DE test for me; building\n     without NO_GETTEXT makes it work. Note that this doesn't affect the\n     first test for ko-KR, because that test sets LANGUAGE, which we\n     read ourselves (so we never make a setlocale() call).\n\n  3. Even building with NO_GETTEXT, setlocale() does not want to\n     report ja_JP.UTF-8 for me, making the third test fail.\n\n     I think the issue is that I do not build the ja_JP locale on my\n     system. Running \"dpkg-reconfigure locales\" and asking it to build\n     ja_JP.UTF-8 makes the test pass. This is somewhat of a Debian-ism.\n     From \"man locale-gen\":\n\n       By default, the locale package which provides the base support\n       for localisation of libc-based programs does not contain usable\n       localisation files for every supported language. This limitation\n       has became necessary because of the substantial size of such\n       files and the large number of languages supported by libc. As a\n       result, Debian uses a special mechanism where we prepare the\n       actual localisation files on the target host and distribute only\n       the templates for them.\n\n     I suspect it is inherited by Debian derivatives like Ubuntu. But I\n     also don't know that we can count on other platforms having all of\n     the locales either (e.g., they may ship them as separate packages,\n     not all of which are installed).\n\n     So I'm not sure of an easy way around this. You want 4 separate\n     locales to thoroughly test, but you cannot rely on any particular\n     locale being present on the user's system.\n\n     Note that this is just a problem with the tests, probably not with\n     the feature itself. Presumably people setting LANG=ja_JP actually\n     have that locale on their system (though technically this feature\n     is about asking the _server_ to use that language, it seems like\n     you would do so because you were using that language locally, too).\n\n-Peff\n"},{"id":"253272","messageId":"54842455.8000603@web.de","threadId":"38122","inReplyTo":"CAFT+Tg_OQLj7oWfOJ8ATKHo36Jv3+JcSYWEc-trKsAtjv7wskg@mail.gmail.com","subject":"Re: Accept-language test fails on Mac OS","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-12-07T09:56:37Z","receivedAt":"2014-12-07T09:56:37Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 07.12.14 07:54, Yi, EungJun wrote:\n> I'm sorry for bothering you, but could you tell me the result of\n> \"locale\" command without \"-a\" option? What I want to know is locale\n> environment variables and its values, so I want to reproduce the test\n> failures on my laptop.\n> \n(Just for completeness:)\n locale\nLANG=en_US.UTF-8\nLANGUAGE=en_US:en\nLC_CTYPE=\"en_US.UTF-8\"\nLC_NUMERIC=\"en_US.UTF-8\"\nLC_TIME=\"en_US.UTF-8\"\nLC_COLLATE=\"en_US.UTF-8\"\nLC_MONETARY=\"en_US.UTF-8\"\nLC_MESSAGES=\"en_US.UTF-8\"\nLC_PAPER=\"en_US.UTF-8\"\nLC_NAME=\"en_US.UTF-8\"\nLC_ADDRESS=\"en_US.UTF-8\"\nLC_TELEPHONE=\"en_US.UTF-8\"\nLC_MEASUREMENT=\"en_US.UTF-8\"\nLC_IDENTIFICATION=\"en_US.UTF-8\"\nLC_ALL=\n"},{"id":"253274","messageId":"548425E2.5080503@web.de","threadId":"38122","inReplyTo":"20141207071827.GA31014@peff.net","subject":"Re: Accept-language test fails on Mac OS","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-12-07T10:03:14Z","receivedAt":"2014-12-07T10:03:14Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 07.12.14 08:18, Jeff King wrote:\n> On Sat, Dec 06, 2014 at 10:04:06PM +0100, Torsten Bögershausen wrote:\n> \n>> I get this:\n>>\n>>\n>> expecting success: \n>>         check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n>>\n>> --- expect      2014-12-06 21:00:59.000000000 +0000\n>> +++ actual      2014-12-06 21:00:59.000000000 +0000\n>> @@ -1 +0,0 @@\n>> -Accept-Language: de-DE, *;q=0.1\n>> not ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n> \n> I can reproduce the same problem here (Debian unstable). I actually ran\n> into three issues (aside from needing to use Junio's SQUASH commit, to\n> avoid the \"\\r\" bash-ism):\n> \n>   1. I couldn't build without including locale.h, for the\n>      definition of setlocale() and the LC_MESSAGES constant (both used\n>      in get_preferred_languages).\n> \n>      I'm not sure what portability issues there are with including it\n>      unconditionally. Should this possibly be tied into gettext.c, which\n>      already uses setlocale?\n> \n>   2. The call to setlocale(LC_MESSAGES, NULL) in get_preferred_languages\n>      always returns \"C\" for me. This seems related to building with\n>      NO_GETTEXT (which I typically do), as we never init setlocale\n>      if NO_GETTEXT is set. This program demonstrates it:\n> \n> \t#include <stdio.h>\n> \t#include <string.h>\n> \t#include <locale.h>\n> \t\n> \tint main(int argc, char **argv)\n> \t{\n> \t\tif (argv[1] && !strcmp(argv[1], \"init\"))\n> \t\t\tsetlocale(LC_MESSAGES, \"\");\n> \t\tprintf(\"%s\", setlocale(LC_MESSAGES, NULL));\n> \t\treturn 0;\n> \t}\n> \n>      If I run it as \"LANG=en_US.UTF-8 ./a.out\", it prints \"C\". If I run\n>      it as \"LANG=en_US.UTF-8 ./a.out init\", it prints \"en_US.UTF-8\". I\n>      think we either need to start unconditionally calling setlocale()\n>      as we do in git_setup_gettext, or we need to tie your feature to\n>      using gettext.\n> \n>      This is what causes the failure of the de-DE test for me; building\n>      without NO_GETTEXT makes it work. Note that this doesn't affect the\n>      first test for ko-KR, because that test sets LANGUAGE, which we\n>      read ourselves (so we never make a setlocale() call).\n> \n>   3. Even building with NO_GETTEXT, setlocale() does not want to\n>      report ja_JP.UTF-8 for me, making the third test fail.\n> \n>      I think the issue is that I do not build the ja_JP locale on my\n>      system. Running \"dpkg-reconfigure locales\" and asking it to build\n>      ja_JP.UTF-8 makes the test pass. This is somewhat of a Debian-ism.\n>      From \"man locale-gen\":\n> \n>        By default, the locale package which provides the base support\n>        for localisation of libc-based programs does not contain usable\n>        localisation files for every supported language. This limitation\n>        has became necessary because of the substantial size of such\n>        files and the large number of languages supported by libc. As a\n>        result, Debian uses a special mechanism where we prepare the\n>        actual localisation files on the target host and distribute only\n>        the templates for them.\n> \n>      I suspect it is inherited by Debian derivatives like Ubuntu. But I\n>      also don't know that we can count on other platforms having all of\n>      the locales either (e.g., they may ship them as separate packages,\n>      not all of which are installed).\n> \n>      So I'm not sure of an easy way around this. You want 4 separate\n>      locales to thoroughly test, but you cannot rely on any particular\n>      locale being present on the user's system.\n> \n>      Note that this is just a problem with the tests, probably not with\n>      the feature itself. Presumably people setting LANG=ja_JP actually\n>      have that locale on their system (though technically this feature\n>      is about asking the _server_ to use that language, it seems like\n>      you would do so because you were using that language locally, too).\n> \n> -Peff\n> --\n(I remember debugging t0204 some time ago)\n\nWe may get inspiration from this, either how to adjust the locale to be used,\nor if the test should be skipped.\n\n grep -l is_IS *\nlib-gettext.sh\nt0200-gettext-basic.sh\nt0203-gettext-setlocale-sanity.sh\nt0204-gettext-reencode-sanity.sh\n"},{"id":"253342","messageId":"CAP8UFD0TSqXMRSpisaQG92_xAizswGKvFV-_N6fdjqbAh8vejA@mail.gmail.com","threadId":"38122","inReplyTo":"20141207071827.GA31014@peff.net","subject":"Re: Accept-language test fails on Mac OS","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2014-12-08T15:51:39Z","receivedAt":"2014-12-08T15:51:39Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Dec 7, 2014 at 8:18 AM, Jeff King <peff@peff.net> wrote:\n> On Sat, Dec 06, 2014 at 10:04:06PM +0100, Torsten Bögershausen wrote:\n>\n>> I get this:\n>>\n>>\n>> expecting success:\n>>         check_language \"ko-KR, *;q=0.1\" ko_KR.UTF-8 de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"de-DE, *;q=0.1\" \"\"          de_DE.UTF-8 ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"ja-JP, *;q=0.1\" \"\"          \"\"          ja_JP.UTF-8 en_US.UTF-8 &&\n>>         check_language \"en-US, *;q=0.1\" \"\"          \"\"          \"\"          en_US.UTF-8\n>>\n>> --- expect      2014-12-06 21:00:59.000000000 +0000\n>> +++ actual      2014-12-06 21:00:59.000000000 +0000\n>> @@ -1 +0,0 @@\n>> -Accept-Language: de-DE, *;q=0.1\n>> not ok 25 - git client sends Accept-Language based on LANGUAGE, LC_ALL, LC_MESSAGES and LANG\n>\n> I can reproduce the same problem here (Debian unstable). I actually ran\n> into three issues (aside from needing to use Junio's SQUASH commit, to\n> avoid the \"\\r\" bash-ism):\n>\n>   1. I couldn't build without including locale.h, for the\n>      definition of setlocale() and the LC_MESSAGES constant (both used\n>      in get_preferred_languages).\n>\n>      I'm not sure what portability issues there are with including it\n>      unconditionally. Should this possibly be tied into gettext.c, which\n>      already uses setlocale?\n\nYeah, pu build is broken on Ubuntu 14.04 too, because of\n7567fad2431eb38291fd74a70f603e5746c6f728 (http: send Accept-Language\nheader if possible).\n\nThanks,\nChristian.\n"}]}