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

Re: gettext CTYPE for libc

From
Duy Nguyen <pclouds@gmail.com>
Date
Nov 25, 2013, 07:20 UTC
Message-ID
<CACsJy8CMUMdzJyDABFj47oY8j8kKr5K88niXoM0o4dVQkWvkqA@mail.gmail.com>
In-Reply-To
<52900FD6.5020202@gmail.com>

Jonathan I see you participated in bug 6530, mentioned in the big comment block in init_gettext_charset(). The bug seems fixed since glibc 2.17. Do you think it's ok to revert the workaround if we detect the running glibc is fixed (or if it does not run glibc at all)? I think we could use gnu_get_libc_version() to detect it.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=6530
On Sat, Nov 23, 2013 at 9:15 AM, Trần Ngọc Quân <vnwildman@gmail.com> wrote:
Show 59 quoted lines
> Hello,
>
> $ mkdir xyz
> $ cd xyz
> $ rmdir ../xyz
> $ git status
> fatal: Unable to read current working directory: Kh?ng c? t?p tin ho?c
> th? m?c nh? v?y
>
> So, somthing wrong with our charset.
>
> $ strace git status 2>&1 | grep open
> open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
> open("/lib/i386-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
> open("/lib/i386-linux-gnu/libcrypto.so.1.0.0", O_RDONLY|O_CLOEXEC) = 3
> open("/lib/i386-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
> open("/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
> open("/lib/i386-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
> open("/dev/null", O_RDWR|O_LARGEFILE)   = 3
> open("/usr/lib/locale/locale-archive", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
> open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
> open("/usr/share/locale/vi_VN/LC_MESSAGES/libc.mo", O_RDONLY) = -1
> ENOENT (No such file or directory)
> open("/usr/share/locale/vi/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT
> (No such file or directory)
> open("/usr/share/locale-langpack/vi_VN/LC_MESSAGES/libc.mo", O_RDONLY) =
> -1 ENOENT (No such file or directory)
> open("/usr/share/locale-langpack/vi/LC_MESSAGES/libc.mo", O_RDONLY) = 3
> open("/usr/lib/i386-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
>
> We will see, this string come from libc.mo
> $ gettext --domain=libc "No such file or directory"
> Không có tập tin hoặc thư mục như vậy
>
> in git's gettext.c, it not allow CTYPE="" for all domain, so we will set
> this one individually. In this ex. I set it for libc:
>
> $ git diff
> diff --git a/gettext.c b/gettext.c
> index 71e9545..abd3978 100644
> --- a/gettext.c
> +++ b/gettext.c
> @@ -115,6 +115,7 @@ static void init_gettext_charset(const char *domain)
>         setlocale(LC_CTYPE, "");
>         charset = locale_charset();
>         bind_textdomain_codeset(domain, charset);
> +       bind_textdomain_codeset("libc", charset);
>         setlocale(LC_CTYPE, "C");
>  }
>
> And it work as I expect!
>
> --
> Trần Ngọc Quân.
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Duy
Previous: Trần Ngọc QuânNext: Jonathan Nieder
Message 4 of 5 in “gettext CTYPE for libc”
  1. Trần Ngọc QuânNov 23, 2013
  2. Thomas RastNov 24, 2013
  3. Trần Ngọc QuânNov 25, 2013
  4. Duy NguyenNov 25, 2013
  5. Jonathan NiederNov 25, 2013

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.