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

Re: Breakage (?) in configure and git_vsnprintf()

From
Jeff King <peff@peff.net>
Date
Dec 12, 2011, 08:10 UTC
Message-ID
<20111212081019.GA17725@sigill.intra.peff.net>
In-Reply-To
<4EE5B123.2030708@viscovery.net>
On Mon, Dec 12, 2011 at 08:45:39AM +0100, Johannes Sixt wrote:
Show 11 quoted lines
> Am 12/12/2011 7:43, schrieb Jeff King:
> > I'll leave the issue of "-std=c89" triggering SNPRINTF_RETURNS_BOGUS to
> > people who know and care about autoconf. My gut is to say "don't do
> > that".
> 
> Right. But Michael's problem was actually that SNPRINTF_RETURNS_BOGUS was
> set incorrectly; his system has a working snprintf (or so I assume). The
> reason for the failure is that ./configure's test program produced a
> warning, and that warning was turned into an error due to -Werror. Without
> -Werror, the test program would have compiled successfully, and the
> working snprintf would have been detected.

Right, I understand that. But he has given a set of options that shouldn't compile git at all (he tells the compiler not to use snprintf via -std=c89, but we require that it exists, because even our git_vsnprintf wrapper uses the underlying system vsnprintf).

So yes, the configure script is broken to detect the situation as SNPRINTF_RETURNS_BOGUS and not "this platform doesn't have snprintf at all"[1]. But I'm saying that the "we do not have snprintf at all" case is not all that interesting: git needs it. So I'm not sure compiling with -std=c89 really makes sense[2].

If somebody wants to make the configure script more accurate, I certainly don't want to stop them. I'm just not sure it is worth anybody's time in this case.

-Peff
[1] Yes, obviously we do actually have it, but it is somewhat a fluke
    that it works. We tell the compiler during the compile phase that we
    don't have it, but then during the link phase it is magically
    available in libc.
[2] I can convince git to compile on recent Linux with gcc using
    CFLAGS='-std=c89 -Dinline='.  Turning on "-Wall -Werror" doesn't
    work because all of the inline functions appear to be unused
    statics.  But if I understand Michael's problem correctly, wouldn't
    we be missing the prototype for snprintf, which could cause subtle
    errors?
Previous: Johannes SixtNext: Junio C Hamano
Message 4 of 10 in “Breakage (?) in configure and git_vsnprintf()”
  1. Michael HaggertyDec 11, 2011
  2. Jeff KingDec 12, 2011
  3. Johannes SixtDec 12, 2011
  4. Jeff KingDec 12, 2011
  5. Junio C HamanoDec 12, 2011
  6. Andreas SchwabDec 12, 2011
  7. Jeff KingDec 12, 2011
  8. Brandon CaseyDec 12, 2011
  9. Michael HaggertyDec 12, 2011
  10. Jonathan NiederDec 12, 2011

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.