Subject: bug#51549: 29.0.50; flymake error when filename contain '%'

From: Stefan Kangas <[email-masked]>
Date: Sat, 6 Nov 2021 04:08:55 -0700

João Távora <[email-masked]> writes:

> Thanks for the report.  I don't have much time to look into this but
> this looks like the typical problem where a user-provided
> string is being passed as the first argument of format/message.
>
> In these cases, one normally makes it so that the first
> argument is simply the string "%s" and then the second
> argument is that user-provided thing.

That's what I thought too, until I looked at the code.  Unfortunately,
the fix we both thought of isn't that trivial as we set
`warning-type-format' like this:

    (warning-type-format
             (format " [%s %s]"
                     (or sublog 'flymake)
                     (current-buffer)))

And then we run `display-warning', which uses this variable as the first
argument to format.

Is there a strong need to have this format for flymake warnings?

    Emergency [flymake foo%sbar.c]: foo

If not, my best idea for fixing this is to remove the filename from the
`warning-type-format', and put it in the message instead.  That would be
a backwards-incompatible change, however.