Breakage (?) in configure and git_vsnprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx
http://softwareswirl.blogspot.com/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]