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

Re: [PATCH v3] gettext.c: detect the vsnprintf bug at runtime

From
Duy Nguyen <pclouds@gmail.com>
Date
Dec 2, 2013, 09:00 UTC
Message-ID
<CACsJy8BqzH7G4yyXMnhgA6kH25eipt9ubqL1S2OdM-ke8GnvJA@mail.gmail.com>
In-Reply-To
<529C3987.7070708@gmail.com>
On Mon, Dec 2, 2013 at 2:40 PM, Trần Ngọc Quân <vnwildman@gmail.com> wrote:
Show 13 quoted lines
> On 02/12/2013 12:57, Duy Nguyen wrote:
>>> I suggest use C preprocessor instead. The person who complete git (make debian, rpm etc. package) decide  enable it or not (disable by default). Most of people use git from distribution instead of complete it from source.
>>>
>>> #ifndef VSNPRINTF_OK
>>>         setlocale(LC_CTYPE, "C");
>>> #endif
>>>
>> A single vsnprintf is cheap enough that I would not worry about
>> performance impact. Given a choice between this and distro
>> maintainers, some of them do check release notes, some not so much,
>> I'd rather go with this.
> We can set this macro automatically  by using autoconf.
> Add following code in configure.ac

Except that most git devs do not use autoconf. I don't know about other but Gentoo also packages git without autoconf. And this test only means that at build time we detect this. glibc version at runtime could be different, as long as they are binary compatible with the build-time one.

Show 27 quoted lines
>
>
> AC_LANG_CONFTEST(
> [AC_LANG_PROGRAM([[
> #include <stdio.h>
> #include <locale.h>
> #include <gnu/libc-version.h>
>
> #define STR "David_K\345gedal"
> ]],[[
>     char buf[20];
>     setlocale(LC_ALL, "en_US.UTF-8");
>     if (snprintf(buf, 13, "%.13s", STR) < 0){
>         printf("0");
>     }else{
>         printf("1");
>     }
> ]])])
> gcc -o conftest conftest.c
> AC_DEFINE([VSNPRINTF_OK], [m4_esyscmd([./conftest])], [Enable l10n libc
> if vnsprintf OK])
>
> You can change c code here!
>
> --
> Trần Ngọc Quân.
>
-- 
Duy
Previous: Trần Ngọc Quân
Message 12 of 12 in “gettext.c: only work around the vsnprintf bug on glibc < 2.17”
  1. gettext.c: only work around the vsnprintf bug on glibc < 2.17Nguyễn Thái Ngọc Duy, Nov 30, 2013
  2. Andreas SchwabNov 30, 2013
  3. gettext.c: only work around the vsnprintf bug on glibc < 2.17Nguyễn Thái Ngọc Duy, Nov 30, 2013
  4. Torsten BögershausenNov 30, 2013
  5. Torsten BögershausenNov 30, 2013
  6. Duy NguyenDec 1, 2013
  7. gettext.c: detect the vsnprintf bug at runtimeNguyễn Thái Ngọc Duy, Dec 1, 2013
  8. Trần Ngọc QuânDec 2, 2013
  9. Duy NguyenDec 2, 2013
  10. Trần Ngọc QuânDec 2, 2013
  11. Trần Ngọc QuânDec 2, 2013
  12. Duy NguyenDec 2, 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.