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 784544 - Fatal error building git master
Fatal error building git master
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2017-07-05 12:16 UTC by Bastien Nocera
Modified: 2017-07-05 13:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Fix format string placeholders for int64 arguments (2.71 KB, patch)
2017-07-05 12:57 UTC, Philip Withnall
committed Details | Review
tools: Avoid zero-length printf() format strings in output code paths (3.37 KB, patch)
2017-07-05 12:57 UTC, Philip Withnall
committed Details | Review
tools: Use puts() instead of printf() to print a string literal (1.33 KB, patch)
2017-07-05 12:57 UTC, Philip Withnall
committed Details | Review
core: Avoid zero-length printf() format strings in debug code paths (2.17 KB, patch)
2017-07-05 12:57 UTC, Philip Withnall
committed Details | Review

Description Bastien Nocera 2017-07-05 12:16:28 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.
Comment 1 Philip Withnall 2017-07-05 12:45:26 UTC
Gah. What version of gcc is this with? I’ll push some fixes in a minute.
Comment 2 Bastien Nocera 2017-07-05 12:49:01 UTC
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
Comment 3 Philip Withnall 2017-07-05 12:57:13 UTC
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
Comment 4 Philip Withnall 2017-07-05 12:57:18 UTC
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>
Comment 5 Philip Withnall 2017-07-05 12:57:24 UTC
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>
Comment 6 Philip Withnall 2017-07-05 12:57:29 UTC
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>
Comment 7 Philip Withnall 2017-07-05 12:57:35 UTC
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>
Comment 8 Philip Withnall 2017-07-05 13:00:10 UTC
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.
Comment 9 Bastien Nocera 2017-07-05 13:03:16 UTC
(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 :)