git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] t: use pre-defined utf-8 locale for testing svn

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Jun 7, 2021, 15:42 UTC
Message-ID
<YL4+ao9L9R6LcN9W@danh.dev>
In-Reply-To
<20210607143815.77djyvxf4xec2qht@tb-raspi4>
On 2021-06-07 16:38:16+0200, Torsten Bögershausen <tboegi@web.de> wrote:
Show 44 quoted lines
> 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.
Show 9 quoted lines
> 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
Previous: Torsten BögershausenNext: Jeff King
Message 13 of 19 in “t: use user-specific utf-8 locale for testing”
  1. t: use user-specific utf-8 locale for testingĐoàn Trần Công Danh, Jun 2, 2021
  2. Taylor BlauJun 2, 2021
  3. Ævar Arnfjörð BjarmasonJun 8, 2021
  4. Jeff KingJun 3, 2021
  5. Bagas SanjayaJun 4, 2021
  6. Đoàn Trần Công DanhJun 4, 2021
  7. t: use user-specific utf-8 locale for testingĐoàn Trần Công Danh, Jun 6, 2021
  8. Torsten BögershausenJun 6, 2021
  9. Junio C HamanoJun 7, 2021
  10. t: use pre-defined utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 7, 2021
  11. Junio C HamanoJun 7, 2021
  12. Torsten BögershausenJun 7, 2021
  13. Đoàn Trần Công DanhJun 7, 2021
  14. Jeff KingJun 8, 2021
  15. Đoàn Trần Công DanhJun 8, 2021
  16. t: use user-specified utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 7, 2021
  17. Jeff KingJun 8, 2021
  18. t: use user-specified utf-8 locale for testing svnĐoàn Trần Công Danh, Jun 8, 2021
  19. Jeff KingJun 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.