After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660356 - build failure with [-Werror=format-security]
build failure with [-Werror=format-security]
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: Test suite
4.2.x
Other Linux
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-28 13:18 UTC by Michael Biebl
Modified: 2011-11-24 08:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build log (870.13 KB, text/x-log)
2011-09-28 13:19 UTC, Michael Biebl
  Details
Can you check with this patch? (1.34 KB, patch)
2011-09-30 20:36 UTC, malerba
committed Details | Review

Description Michael Biebl 2011-09-28 13:18:31 UTC
When compiling libgda 4.2.9 with -Werror=format-security, the test suite fails to build:

make[4]: Entering directory `/home/michael/debian/build-area/libgda-4.2.9/tests/providers'
\
#↦      source='prov-test-common.c' object='check_sqlite-prov-test-common.o' libtool=no»
gcc -DPACKAGE_NAME=\"GNU\ Data\ Access\" -DPACKAGE_TARNAME=\"libgda\" -DPACKAGE_VERSION=\"4.2.9\" -DPACKAGE_STRING=\"GNU\ Data\ Access\ 4.2.9\" -DPACKAGE_BUGREPORT=\"gnome-db-list@gnome.org\" -DPACKAGE_URL=\"http://www.gnu.org/software/libgda/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG_INT=4 -DHAVE_LOCALTIME_R=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_GDU=1 -DGETTEXT_PACKAGE=\"libgda-4.0\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -DISO_CODES_PREFIX=\"/usr\" -DHAVE_ICONV=1 -DICONV_CONST= -DHAVE_LIBSOUP=1 -DHAVE_READLINE=1 -DHAVE_HISTORY=1 -DHAVE_TERMIOS_H=1 -I.  -I../.. -I../../libgda -I../.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2   -DLIBGDA_ABI_NAME=\"libgda-4.0\" -Wall -DCHECK_SQL_FILES=\""../.."\"   -g -O2 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Wall -c -o check_sqlite-prov-test-common.o `test -f 'prov-test-common.c' || echo './'`prov-test-common.c
prov-test-common.c: In function ‘prov_test_common_setup’:
prov-test-common.c:56:5: error: format not a string literal and no format arguments [-Werror=format-security]
prov-test-common.c:71:4: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors


complete build log attached
Comment 1 Michael Biebl 2011-09-28 13:19:09 UTC
Created attachment 197660 [details]
build log
Comment 2 malerba 2011-09-30 20:36:38 UTC
Created attachment 197914 [details] [review]
Can you check with this patch?

I could not reproduce the bug with the version of GCC I have, and could not identify the reason of the warning, so I removed the usage of macros altogether as they really are not necessary. Please let me know if it's Ok, or if you have another solution.
Vivien
Comment 3 Murray Cumming 2011-10-07 10:19:10 UTC
Michael, please respond.
Comment 4 Michael Biebl 2011-10-07 20:38:23 UTC
(In reply to comment #3)
> Michael, please respond.

The patch did not apply on top of 4.2.9 but with a bit of manual fiddling it worked.

With the patch, 4.2.9 no longer fails with [-Werror=format-security].
Please also not, that 4.2.8 did not have this issue, as it used

fail (str);
#define fail(x) g_warning (x)

instead of
#define fail(x) g_warning ("%s", x)



That said, make check still fails to compile in 4.2.9

/bin/bash ../../libtool  --tag=CC   --mode=link gcc  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Wall  -Wl,-z,defs -Wl,--as-needed -Wl,-O1 -o check_rewrite_for_null check_rewrite_for_null.o ../../libgda/libgda-4.0.la  
libtool: link: gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Wall -Wl,-z -Wl,defs -Wl,--as-needed -Wl,-O1 -o .libs/check_rewrite_for_null check_rewrite_for_null.o  ../../libgda/.libs/libgda-4.0.so -pthread
/usr/bin/ld: check_rewrite_for_null.o: undefined reference to symbol 'g_object_get'
/usr/bin/ld: note: 'g_object_get' is defined in DSO /usr/lib/libgobject-2.0.so.0 so try adding it to the linker command line
/usr/lib/libgobject-2.0.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[3]: *** [check_rewrite_for_null] Error 1
make[3]: Leaving directory `/home/michael/debian/build-area/libgda-4.2.9/tests/parser'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/michael/debian/build-area/libgda-4.2.9/tests/parser'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/michael/debian/build-area/libgda-4.2.9/tests'
make: *** [check-recursive] Error 1


But this should be handled in a separate bug report. I'm just mentioning it.
Comment 5 Murray Cumming 2011-11-02 08:10:15 UTC
(In reply to comment #2)
> Created an attachment (id=197914) [details] [review]
> Can you check with this patch?

Shall we apply this patch?
Comment 6 Murray Cumming 2011-11-24 08:55:30 UTC
(In reply to comment #5)
> Shall we apply this patch?

Actually, it seems to have been applied already, probably accidentally as part of this commit:
http://git.gnome.org/browse/libgda/commit/?id=e9c11d2fde225bb568f879a194c85e74b3c53664
(Vivien, I wish you would mention the bug titles as well as the bug numbers in commit messages.)

Michael, please reopen this bug if it is still a problem. Note that --enable-warnings=fatal (passed to autogen.sh or configure) already uses the format-security warning, but there are various other warnings (such as use of deprecated API) that stop that build from succeeding.