Re: FTBFS if "-Werror=format-security" flag is used

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

 



On 12/10/2013 04:35 PM, Miloslav Trmač wrote:
On Tue, Dec 10, 2013 at 3:50 PM, Kevin Kofler <kevin.kofler@xxxxxxxxx> wrote:
drago01 wrote:

On Tue, Dec 10, 2013 at 3:00 AM, Kevin Kofler <kevin.kofler@xxxxxxxxx>

-Werror=format-security removes the functionality of building format strings
at runtime, and there are legitimate uses for such functionality.

(info gcc) says that format-security only applies to calls "where the
format string is not a string literal _and there are no format
arguments_", which is not the case for the wrapper above.  Is the
documentation incorrect?

The documentation seems right in the sense as GCC seems to be doing what the documentation tells.


The problems are elsewhere:

1. There are legitimate use-cases where GCC's assumption does not hold, .e.g.:

#include <stdio.h>

void foo( int a )
{
  char hello0[] = "hello0";
  char hello1[] = "hello1";

  char *ptr;

  switch (a % 2) {
  case 0: ptr = hello0;
    break;
  case 1: ptr = hello1;
    break;
  }

  printf( ptr );
}

=> The warning GCC issues is plain wrong.

=> -Werror=format-security removes the functionality of assigning pointers to format strings even if they are constant.


2. Raising warnings to errors (-Werror) at distribution scope is a silly undertaking in general. -Werror is a debugging/development/testing aid aimed at developers but is entirely inadequate at distribution (or package scope).


Ralf




--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux