git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: git discussion list <git@vger.kernel.org>
Cc: Michal Rokos <michal.rokos@nextsoft.cz>,
	Brandon Casey <casey@nrlssc.navy.mil>
Subject: Breakage (?) in configure and git_vsnprintf()
Date: Sun, 11 Dec 2011 19:42:03 +0100	[thread overview]
Message-ID: <4EE4F97B.9000202@alum.mit.edu> (raw)

I found a mysterious bunch of test suite failures when I compiled git on
a 64-bit Linux 3.0.0 using gcc 4.6.1:

    git clean -f -x -d
    make clean
    make configure
    ./configure --prefix=$HOME CFLAGS='-g -O0 -std=c89 -Wall -Werror'
    make test

The failure unexpectedly depended on the presence of all three compiler
options "-std=c89 -Wall -Werror".  There is no difference between -O0
and -O2.  The breakage is in v1.7.7, v1.7.8, and master (I didn't try
older versions).

I have been using "-std=c89" when compiling to avoid accidentally using
newer C features.  Perhaps that is unwise :-)

The same test succeeds on 32-bit Linux 2.6.32 using gcc 4.4.3.

There seem to be two levels to the problem:


1. With this choice of compiler options, configure incorrectly convinces
itself that the system's snprintf() is broken and sets
SNPRINTF_RETURNS_BOGUS.  From config.log:

configure:5368: checking whether snprintf() and/or vsnprintf() return
bogus value
configure:5406: cc -o conftest -g -O0 --std=c89 -Wall -Werror
conftest.c  >&5
conftest.c: In function 'test_vsnprintf':
conftest.c:62:5: error: implicit declaration of function 'vsnprintf'
[-Werror=implicit-function-declaration]
conftest.c: In function 'main':
conftest.c:72:5: error: implicit declaration of function 'snprintf'
[-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors

configure:5406: $? = 1
configure: program exited with status 1

According to the manpage, snprintf() and vsnprintf() are truly not
supported for "-std=c89" and indeed they are not declared by any of the
files included by the test program that configure is using.  (Oddly,
although they are nominally not supported, vsnprintf() is used anyway in
the definition of git_vsnprintf().)

If I leave off any of the compilation options "-std=c89 -Wall -Werror"
or if I toggle the "#ifdef SNPRINTF_RETURNS_BOGUS" line in
git-compat-util.h off, the problem goes away.


2. The configure problem causes git_vsnprintf() to be wrapped around the
C library version.  This leads to many failures in the test suite.  I
suppose that git_vsnprintf() is broken in some way.


I'm kindof busy with my ref-api patch series so I won't have time to
look further into this problem in the near future.  But perhaps somebody
with experience with the configuration system and/or git_vsnprintf() is
interested.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

             reply	other threads:[~2011-12-11 18:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-11 18:42 Michael Haggerty [this message]
2011-12-12  6:43 ` Breakage (?) in configure and git_vsnprintf() Jeff King
2011-12-12  7:45   ` Johannes Sixt
2011-12-12  8:10     ` Jeff King
2011-12-12  8:23   ` Junio C Hamano
2011-12-12  9:30   ` Andreas Schwab
2011-12-12 14:25     ` Jeff King
2011-12-12 23:25       ` Brandon Casey
2011-12-12 10:25   ` Michael Haggerty
2011-12-12 21:56   ` Jonathan Nieder

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=4EE4F97B.9000202@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=casey@nrlssc.navy.mil \
    --cc=git@vger.kernel.org \
    --cc=michal.rokos@nextsoft.cz \
    /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).