GNOME Bugzilla – Bug 784544
Fatal error building git master
Last modified: 2017-07-05 13:03:16 UTC
/home/hadess/Projects/jhbuild/folks/folks/backend-store.vala: In function ‘_folks_backend_store_debug_print_status’: /home/hadess/Projects/jhbuild/folks/folks/backend-store.vala:260:50: error: zero-length gnu_printf format string [-Werror=format-zero-length] debug.print_line (domain, level, ""); ^ gcc doesn't like the empty printf.
Gah. What version of gcc is this with? I’ll push some fixes in a minute.
gcc (GCC) 7.1.1 20170526 (Red Hat 7.1.1-2) In Fedora 26. I have those in my CFLAGS: -Werror=format=2 -Wformat=2
The following fixes have been pushed: 9978cf2 tests: Fix format string placeholders for int64 arguments 8b786b6 tools: Avoid zero-length printf() format strings in output code paths ba429bd tools: Use puts() instead of printf() to print a string literal f53094b core: Avoid zero-length printf() format strings in debug code paths
Created attachment 354916 [details] [review] tests: Fix format string placeholders for int64 arguments %lld is not always guaranteed to be the same size as an int64, because different architectures helpfully have a different idea of what counts as ‘long’. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 354917 [details] [review] tools: Avoid zero-length printf() format strings in output code paths This triggers -Werror=format-zero-length from gcc. Add a new private utility function for outputting a blank line, which also makes the code a bit more legible. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 354918 [details] [review] tools: Use puts() instead of printf() to print a string literal We’ve already handled all the format placeholders in this output string, so don’t invite output format attacks by trying to handle more of them again. puts() adds a trailing newline, so remove that from the string. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Created attachment 354919 [details] [review] core: Avoid zero-length printf() format strings in debug code paths This triggers -Werror=format-zero-length from gcc. Rather than introduce new public API on the Debug class for this purpose, just work around it by %s formatting an empty string. Signed-off-by: Philip Withnall <withnall@endlessm.com>
I’m afraid I don’t have the willpower to do another folks release such a short time after the last. The patches you definitely need for the RPM are: 8b786b6 tools: Avoid zero-length printf() format strings in output code paths ba429bd tools: Use puts() instead of printf() to print a string literal f53094b core: Avoid zero-length printf() format strings in debug code paths The other one is a bit more frivolous.
(In reply to Philip Withnall from comment #8) > I’m afraid I don’t have the willpower to do another folks release such a > short time after the last. The RPM built fine :)