All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Taylor Blau <ttaylorr@github.com>,
	Jeff King <peff@peff.net>, Bagas Sanjaya <bagasdotme@gmail.com>
Subject: Re: [PATCH v3] t: use pre-defined utf-8 locale for testing svn
Date: Mon, 7 Jun 2021 22:42:34 +0700	[thread overview]
Message-ID: <YL4+ao9L9R6LcN9W@danh.dev> (raw)
In-Reply-To: <20210607143815.77djyvxf4xec2qht@tb-raspi4>

On 2021-06-07 16:38:16+0200, Torsten Bögershausen <tboegi@web.de> wrote:
> On Mon, Jun 07, 2021 at 10:01:12AM +0900, Junio C Hamano wrote:
> > Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:
> >
> > > Subject: Re: [PATCH v3] t: use pre-defined utf-8 locale for testing svn
> >
> > That certainly is better than "user-specific", but a lot worse than
> > "user-specified".  "pre-defined" leaves it open to question "who
> > defines it?", and it is a reasonable interpretation that the locale
> > may be hardcoded in the makefile, but that is not what this patch
> > does.  Saying "user-specified" would not have such a problem.
> >
> > >> I kind of wonder if trying "C.UTF-8" would be a reasonable fallback so
> > >> that people don't even have to set this extra Makefile knob. But I'm not
> > >> sure if we have a good way of testing if that locale works (if we can't
> > >> find the "locale" binary).
> > >
> > > I also think we should fallback to "C.UTF-8" instead of not testing those
> > > tests.  However, I don't know if there're any systems that not have "C.UTF-8"
> > > locale.
> >
> > I do share the feeling, but have a hunch that systems lacking
> > "locale -a" may be either superset of, or has at least large overlap
> > with, those lacking "C.UTF-8", and the new mechanism introduced here
> > will cover both of them, so I think it is OK to stop here, at least
> > for now.
> >
> > Thanks.
> 
> I did a little bit of digging, the first (?) usage of locale was probably
> introduced in the i18n patch to use gettext and msgfmt and stuff:
> 
> commit 5e9637c629702e3d41ad01d95956d1835d7338e0
> Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> Date:   Fri Nov 18 00:14:42 2011 +0100
> 
>     i18n: add infrastructure for translating Git with gettext
> 
> --------------------------
> 
> I can't get rid of the feeling, that most systems have an UTF-8
> locale enabled by default these days.
> 
> What does the following give us under Linux musl ?
> set | grep UTF

It's empty.

OK, I lied.  Distributions include a file in /etc/profile.d to enable
LC_ALL/LANG.  Without that file, it's empty.  However, such use-case
is covered by our fallback to LC_ALL and LANG.

Technically, Linux with musl always knows those locales C, POSIX,
C.UTF-8

I worried more about other systems instead.

> MacOs (my box here) has this:
> 
> LANG=en_US.UTF-8
> LC_ALL=en_US.UTF-8
> LC_CTYPE=UTF-8
> XTERM_LOCALE=en_US.UTF-8
> 
> If, and only if, Linux musl has a similar setup,
> then we may be able to skip the Makefile knob for the moment.

Yes, this patch allows to skip the Makefile knob.  Because LC_ALL and
LANG will be the first and second fallback, respectively.  And we can
skip a (potentially expensive) call to "locale -a".

> Just skip locale -a, if locale is not available.
> This is just a loose idea, I need to install the git-svn bindings and
> test if the git-svn tests pass.

-- 
Danh

  reply	other threads:[~2021-06-07 15:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 11:46 [PATCH] t: use user-specific utf-8 locale for testing Đoàn Trần Công Danh
2021-06-02 19:56 ` Taylor Blau
2021-06-08 10:49   ` Ævar Arnfjörð Bjarmason
2021-06-03 19:27 ` Jeff King
2021-06-04  3:32 ` Bagas Sanjaya
2021-06-04  5:20   ` Đoàn Trần Công Danh
2021-06-06 16:33 ` [PATCH v2] " Đoàn Trần Công Danh
2021-06-06 20:06   ` Torsten Bögershausen
2021-06-07  0:20     ` Junio C Hamano
2021-06-07  0:48 ` [PATCH v3] t: use pre-defined utf-8 locale for testing svn Đoàn Trần Công Danh
2021-06-07  1:01   ` Junio C Hamano
2021-06-07 14:38     ` Torsten Bögershausen
2021-06-07 15:42       ` Đoàn Trần Công Danh [this message]
2021-06-08  6:35     ` Jeff King
2021-06-08  6:45       ` Đoàn Trần Công Danh
2021-06-07  1:08 ` [PATCH v4] t: use user-specified " Đoàn Trần Công Danh
2021-06-08  6:38   ` Jeff King
2021-06-08  6:56 ` [PATCH v5] " Đoàn Trần Công Danh
2021-06-08  7:26   ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YL4+ao9L9R6LcN9W@danh.dev \
    --to=congdanhqx@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    --cc=ttaylorr@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.