unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Stefan Kangas <stefan@marxist.se>
Cc: Ola x Nilsson <ola.x.nilsson@axis.com>, 51549@debbugs.gnu.org
Subject: bug#51549: 29.0.50; flymake error when filename contain '%'
Date: Sat, 6 Nov 2021 09:37:54 +0000	[thread overview]
Message-ID: <CALDnm53=JasmX+t6-6xgRnb+oathepA2Unv6oFAhX2LREM6F3w@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmkWiLLw4jqHMZRQ264AWpVwGginL=7V2yrB2OWfqjF8xQ@mail.gmail.com>

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@marxist.se> wrote:
>
> tags 51549 + confirmed
> thanks
>
> Ola x Nilsson <ola.x.nilsson@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





  reply	other threads:[~2021-11-06  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 11:52 bug#51549: 29.0.50; flymake error when filename contain '%' Ola x Nilsson
2021-11-06  8:30 ` Stefan Kangas
2021-11-06  9:37   ` João Távora [this message]
2021-11-06 11:08     ` Stefan Kangas
2021-11-06 16:45       ` João Távora
2021-11-06 20:06         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALDnm53=JasmX+t6-6xgRnb+oathepA2Unv6oFAhX2LREM6F3w@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=51549@debbugs.gnu.org \
    --cc=ola.x.nilsson@axis.com \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).