Bug 1038070

Summary: -Werror=format-security false positive on constant
Product: [Fedora] Fedora Reporter: Karel Volný <kvolny>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jakub, kvolny, law
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-01 15:21:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1037377    
Attachments:
Description Flags
allmenus.cpp preprocessed none

Description Karel Volný 2013-12-04 11:08:03 UTC
Description of problem:
Recently, I got bug #1037377, where there are these errors:

allmenus.cpp:367:69: error: format not a string literal and no format arguments [-Werror=format-security]
allmenus.cpp:370:69: error: format not a string literal and no format arguments [-Werror=format-security]

The offending lines (both) read:

fprintf (stdout, bindtextdomain (PACKAGE, LOCALEDIR));

but PACKAGE and LOCALEDIR are constants defined by make, and to my best knowledge, a constant _is_ one of things that "string literal" stands for, so the error does not make any sense to me - I think it is a false positive.

Version-Release number of selected component (if applicable):
(ask dkholia about the environment)

How reproducible:
(haven't tried myself)

Steps to Reproduce:
1. rebuild vodovod package with -Werror=format-security

Actual results:
allmenus.cpp:367:69: error: format not a string literal and no format arguments [-Werror=format-security]
allmenus.cpp:370:69: error: format not a string literal and no format arguments [-Werror=format-security]
njamfont.cpp:119:44: error: format not a string literal and no format arguments [-Werror=format-security]
njamfont.cpp:128:44: error: format not a string literal and no format arguments [-Werror=format-security]


Expected results:
no errors

Additional info:

Comment 1 Jakub Jelinek 2013-12-07 07:30:49 UTC
Please attach preprocessed source.

Comment 2 Karel Volný 2014-01-31 17:38:22 UTC
Created attachment 857937 [details]
allmenus.cpp preprocessed

hope this is what are you asking for ...?

Comment 3 Jakub Jelinek 2014-02-01 15:21:31 UTC
The warning is correct, the bindtextdomain function certainly isn't a format_arg attribute function like e.g. gettext, etc., so you should of course use "%s", bindtextdomain (...) instead.

Comment 4 Karel Volný 2014-02-03 19:00:39 UTC
sorry for the noise then and thanks for the explanation in the other (not-a-)bug

(/me still doesn't understand what does it mean "like e.g. gettext", but whatever)