[Mageia-dev] broken format-error test ?

Pascal Terjan pterjan at gmail.com
Sun Aug 12 00:55:24 CEST 2012


On Sat, Aug 11, 2012 at 11:45 PM, Pascal Terjan <pterjan at gmail.com> wrote:
> On Sat, Aug 11, 2012 at 11:41 PM, Pascal Terjan <pterjan at gmail.com> wrote:
>> On Sat, Aug 11, 2012 at 11:32 PM, Guillaume Rousse
>> <guillomovitch at gmail.com> wrote:
>>> Hello list.
>>>
>>> While trying to rebuild mod_ruby, I get this error:
>>> mod_ruby.c:507:5: erreur: le format n'est pas une chaīne littérale et pas
>>> d'argument de format [-Werror=format-security]
>>>
>>> The line 505 is;
>>> vsnprintf(buf, BUFSIZ, fmt, args);
>>>
>>> Apparently, the test fails to recognize the 'fmt' variable as the format...
>>
>> Well, it complains that fmt is a variable, which is the point of the
>> test, so it is not broken
>> Only constant formats are allowed
>
> Ah no sorry, it should accept a variable when there are arguments.

The full log, which explains the problem:

mod_ruby.c: In function 'ruby_log_error':
mod_ruby.c:507:5: warning: passing argument 5 of 'ap_log_error_' makes
integer from pointer without a cast [enabled by default]
In file included from mod_ruby.h:104:0,
                 from mod_ruby.c:33:
/usr/include/httpd/http_log.h:372:18: note: expected 'apr_status_t'
but argument is of type 'const struct server_rec *'
mod_ruby.c:507:5: warning: passing argument 6 of 'ap_log_error_' from
incompatible pointer type [enabled by default]
In file included from mod_ruby.h:104:0,
                 from mod_ruby.c:33:
/usr/include/httpd/http_log.h:372:18: note: expected 'const struct
server_rec *' but argument is of type 'char *'
mod_ruby.c:507:5: error: format not a string literal and no format
arguments [-Werror=format-security]

The error is not on the line 505 but 507:

    ap_log_error(file, line, level, 0, s, "mod_ruby: %s", buf);

Which is defined as:

AP_DECLARE(void) ap_log_error_(const char *file, int line, int module_index,
                               int level, apr_status_t status,
                               const server_rec *s, const char *fmt, ...)
                              __attribute__((format(printf,7,8)));

so the call is missing module_index, parameters are shiffted and buf
is considered to be the format.


More information about the Mageia-dev mailing list