GNU bug report logs - #51549
29.0.50; flymake error when filename contain '%'

Previous Next

Package: emacs;

Reported by: Ola x Nilsson <ola.x.nilsson <at> axis.com>

Date: Mon, 1 Nov 2021 11:53:02 UTC

Severity: normal

Tags: confirmed

Found in version 29.0.50

Fixed in version 28.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


Message #13 received at 51549 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Ola x Nilsson <ola.x.nilsson <at> axis.com>, 51549 <at> debbugs.gnu.org
Subject: Re: bug#51549: 29.0.50; flymake error when filename contain '%'
Date: Sat, 6 Nov 2021 09:37:54 +0000
Hi Stefan, Ola

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.

Thanks very much for looking into this,
João

On Sat, Nov 6, 2021 at 8:30 AM Stefan Kangas <stefan <at> marxist.se> wrote:
>
> tags 51549 + confirmed
> thanks
>
> Ola x Nilsson <ola.x.nilsson <at> axis.com> writes:
>
> > Flymake includes the buffer name in `warning-type-format' (see
> > `flymake--log-1').
> > When the file name - and the buffer name - contain a % character it is
> > very probable that the `format' call in `display-warning' either fails
> > or produce unexpected results.
> >
> > In my case I used a file name arm-trusted-firmware-2.4_%.bbappend with a
> > local flymake backend running a local linter.
> > The local backend uses a process sentinel to process errors and generate
> > flymake diagnostic objects with
> >
> >    (flymake-make-diagnostic source beg end type msg)
> >
> > where
> > source is the buffer visiting arm-trusted-firmware-2.4_%.bbappend,
> > bed and end set from `flymake-diag-region'
> > type is :warning
> > and msg is a string with the error message from the linter.
>
> Thanks for the bug report.  I can reproduce this using this contrived
> example:
>
> ./src/emacs -Q --eval "(progn (require 'flymake) (find-file
> \"/tmp/foo%sbar.c\") \
>     (flymake--log-1 :emergency nil \"foo\"))"
>
> I now see in the *Warnings* buffer:
>
>     Emergency [flymake fooflymakebar.c]: foo
>
> The expected output is:
>
>     Emergency [flymake foo%sbar.c]: foo
>
> Your analysis of why the problem happens seems correct to me, but I'm
> not sure how to best fix it.  João, what do you think?



-- 
João Távora




This bug report was last modified 3 years and 194 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.