Re: Fwd: [PATCH] fix format security

Collin Funk <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.editors.poke.devel
Message-ID <[email protected]>
Bruno Haible via Gnulib discussion list <[email protected]> writes:

> Hi Luca,
>
>> A user suggests changing
>> 
>>    error (exit_failure, errnum,
>>          _("failed to return to initial working directory"));
>> 
>> to
>> 
>>    error (exit_failure, errnum,
>>          "%s", _("unable to record current working directory"));
>> 
>> (twice) in openat-die.c, in order to silence a clang warning.  I see
>> that the latest Gnulib is still without the format string.  What do you
>> think?
>
> First, make sure that you use the newest gettext.h from Gnulib. This
> will fix the warning with gcc.
>
> Then, if the warning still appears:
>
> clang is buggy.
>
> Use gcc instead of clang, or silence the warning through a -W option,
> or ignore the warning.
>
> More details here:
> https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00266.html
> https://lists.gnu.org/archive/html/bug-gnulib/2025-06/msg00327.html
> https://lists.gnu.org/archive/html/bug-gnulib/2026-01/msg00088.html

It is a bit unfortunate that this warning comes up almost monthly
because clang doesn't special case gettext, misleading well-meaning bug
reporters...

I'll check if there is an existing clang report or file one later.

Collin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.