From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9D3F51F852; Tue, 1 Feb 2022 23:34:28 +0000 (UTC) Date: Tue, 1 Feb 2022 23:34:28 +0000 From: Eric Wong To: Julien Moutinho Cc: Dominique Martinet , meta@public-inbox.org Subject: [PATCH] test_lei: use consistent locale for error messages Message-ID: <20220201233428.M540717@dcvr> References: <20211208010730.f47xxgzj53nwgvja@sourcephile.fr> <20211208040836.GA27368@dcvr> <20211209013743.okzgim7bbrpahks7@sourcephile.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211209013743.okzgim7bbrpahks7@sourcephile.fr> List-Id: Julien Moutinho wrote: > Which is an artifact of my testing method, because with an absolute perl: > $ (cd public-inbox-1.7.0; $(which perl) -I$out/lib/perl5/site_perl t/lei-q-save.t ) > > [...] > > not ok 95 - git config parse error shown w/ lei ls-search > > # Failed test 'git config parse error shown w/ lei ls-search' > > # at t/lei-q-save.t line 228. > > # 'fatal: ligne 3 de config incorrecte dans le fichier /tmp/nix-shell.EKTZrS/pi-lei-q-save-3132353-xECZ/lei-daemon/.local/share/lei/saved-searches/after-c8d60f185616bece7957076be4604781d6cae876642a4faa127a2fcfc9647fc8/lei.saved-search > > # git config -z -l --includes --file=/tmp/nix-shell.EKTZrS/pi-lei-q-save-3132353-xECZ/lei-daemon/.cache/lei/saved-tmp.3132468.1639007508.config failed: $?=32768 > > # ' > > # doesn't match '(?^:bad config line.*?\/tmp\/nix\-shell\.EKTZrS\/pi\-lei\-q\-save\-3132353\-xECZ\/lei\-daemon\/\.local\/share\/lei\/saved\-searches\/after\-c8d60f185616bece7957076be4604781d6cae876642a4faa127a2fcfc9647fc8\/lei\.saved\-search)' > > ok 96 - lei up --all (up works with bad config) > > not ok 97 - git config parse error shown w/ lei up > > # Failed test 'git config parse error shown w/ lei up' > > # at t/lei-q-save.t line 231. > > # 'fatal: ligne 3 de config incorrecte dans le fichier /tmp/nix-shell.EKTZrS/pi-lei-q-save-3132353-xECZ/lei-daemon/.local/share/lei/saved-searches/after-c8d60f185616bece7957076be4604781d6cae876642a4faa127a2fcfc9647fc8/lei.saved-search > > # git config -z -l --includes --file=/tmp/nix-shell.EKTZrS/pi-lei-q-save-3132353-xECZ/lei-daemon/.cache/lei/saved-tmp.3132468.1639007508.config failed: $?=32768 > > # ' > > # doesn't match '(?^:bad config line.*?\/tmp\/nix\-shell\.EKTZrS\/pi\-lei\-q\-save\-3132353\-xECZ\/lei\-daemon\/\.local\/share\/lei\/saved\-searches\/after\-c8d60f185616bece7957076be4604781d6cae876642a4faa127a2fcfc9647fc8\/lei\.saved\-search)' > It succeeds if I use LANG=C instead of LANG=fr_FR.UTF-8 ---------8<--------- Subject: [PATCH] test_lei: use consistent locale for error messages git-config(1) error messages are locale-dependent, so follow the lead taken by git's own test suite and set LC_ALL=C and LANG=C to ensure error messages we check against are not localized. --- lib/PublicInbox/TestCommon.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 052d6e45..ca732811 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -568,6 +568,7 @@ SKIP: { delete $ENV{XDG_CACHE_HOME}; $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com'; $ENV{GIT_COMMITTER_NAME} = 'lei user'; + $ENV{LANG} = $ENV{LC_ALL} = 'C'; my (undef, $fn, $lineno) = caller(0); my $t = "$fn:$lineno"; state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||