git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Trần Ngọc Quân" <vnwildman@gmail.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>,
	"Jonathan Niedier" <jrnieder@gmail.com>,
	"Andreas Schwab" <schwab@linux-m68k.org>,
	"Torsten Bögershausen" <tboegi@web.de>
Subject: Re: [PATCH v3] gettext.c: detect the vsnprintf bug at runtime
Date: Mon, 02 Dec 2013 14:40:55 +0700	[thread overview]
Message-ID: <529C3987.7070708@gmail.com> (raw)
In-Reply-To: <CACsJy8B5aBGnm=04y60W1XVovHVryP1Co0_mmgV0f7Ox13aGjw@mail.gmail.com>

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


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.

  reply	other threads:[~2013-12-02  7:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-30  1:51 [PATCH] gettext.c: only work around the vsnprintf bug on glibc < 2.17 Nguyễn Thái Ngọc Duy
2013-11-30  9:51 ` Andreas Schwab
2013-11-30 12:01 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2013-11-30 23:01   ` Torsten Bögershausen
2013-11-30 23:06     ` Torsten Bögershausen
2013-12-01  1:33     ` Duy Nguyen
2013-12-01  2:45   ` [PATCH v3] gettext.c: detect the vsnprintf bug at runtime Nguyễn Thái Ngọc Duy
2013-12-02  0:31     ` Trần Ngọc Quân
2013-12-02  5:57       ` Duy Nguyen
2013-12-02  7:40         ` Trần Ngọc Quân [this message]
2013-12-02  8:49           ` Trần Ngọc Quân
2013-12-02  9:00           ` Duy Nguyen

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=529C3987.7070708@gmail.com \
    --to=vnwildman@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=schwab@linux-m68k.org \
    --cc=tboegi@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).