On Mon, Jan 12, 2026 at 2:27 PM Bruno Haible <[email protected]> wrote:

> Khem Raj wrote:
> > Clang 22 treats format strings more strictly and flags the use of
> > gettext-translated strings directly as format arguments without an
> > explicit format specifier as a security issue.
> >
> > Add "%s" format specifier to properly handle the translated strings.
> >
> > Fixes errors like:
> > error: format string is not a string literal (potentially insecure)
> [-Werror,-Wformat-security]
>
> 1. It is not an error. It is a warning, and *you* (or the coreutils
> configure.ac)
>    decided to turn the warning into an error.
>
> 2. The patch is wrong. We discussed this already a while ago, and the
> summary
>    is [1]:
>    - There is nothing to warn about, because format string translations
>      returned by _() are checked by 'msgfmt -c'.
>    - It works with gcc. gcc hides such warnings when the function is
> gettext().
>

I wonder if this is the right thing to do. GCC does it, but should the
compiler in general
treat gettext() as special ?


>    - Therefore you can either use gcc instead of clang, or modify clang to
>      hide such warnings like gcc does.
>

Sure and I am aware of that, I was wondering what could be done to make it
work across different compilers.


>
> Bruno
>
> [1] https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00266.html
>
>
>
>

Reply via email to