All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Anatolij Gustschin <agust@denx.de>, Tom Rini <trini@konsulko.com>,
	 U-Boot Mailing List <u-boot@lists.denx.de>,
	Masahisa Kojima <masahisa.kojima@linaro.org>,
	 Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [BUG] Re: [PATCH v3 02/25] cli: Move readline character-processing to a state machine
Date: Sat, 28 Jan 2023 15:01:28 -0700	[thread overview]
Message-ID: <CAPnjgZ3eDJ3+Tv7HDD=iYng8DD4_zdn-k-WXtHxXYYhGwaReCQ@mail.gmail.com> (raw)
In-Reply-To: <c31882a9-34d0-95ca-0429-402f5ace64cc@canonical.com>

Hi Heinrich,

On Tue, 24 Jan 2023 at 08:19, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> On 1/6/23 15:52, Simon Glass wrote:
> > The current cread_line() function is very long. It handles the escape
> > processing inline. The menu command does similar processing but at the
> > character level, so there is some duplication.
> >
> > Split the character processing into a new function cli_ch_process() which
> > processes individual characters and returns the resulting input character,
> > taking account of escape sequences. It requires the caller to set up and
> > maintain its state.
> >
> > Update cread_line() to use this new function.
> >
> > The only intended functional change is that an invalid escape sequence
> > does not add invalid/control characters into the input buffer, but instead
> > discards these.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
>
> Hello Simon
>
> in the Change Boot Order menu of the eficonfig command I hit the
> PAGE-UP or PAGE-DOWN button and get this output:
>
>        [ ]  label0038
>        [ ]  label0039impossible condition #876
> impossible condition #876
>    Press UP/DOWN to move, +/- to change orde
>    Press SPACE to activate or deactivate the entry
>    Select [Save] to complete, ESC/CTRL+C to quit
>
> Hitting an unsupported key should not result in output.
>
> This is the line providing the output.
>
> common/cli_getch.c:201:
> puts("impossible condition #876\n");
>
> How line be reached by an "impossible condition". That text does not
> make any sense.
>
> This is the patch to blame
>
> b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
>
> Please, remove that debug message.

This was already in the code. I just split it out into a separate file.

>
> The conitrace command shows these escape sequences:
>
> PAGE-DOWN 1b 5b 36 7e
> PAGE-UP 1b 5b 35 7e

I believe it indicates that the sequence is not understood. It is
therefore rejected and sent out as an escape sequence to the terminal.

This works by calling cli_ch_process() with a character of 0, to find
out if there is a rejected sequence to be emitted. Only once it
returns 0 should getchar() be called. See the detailed function
comments for how it works.

From what I can see, bootmenu_autoboot_loop() is violating that.
Probably that is what is going on. The message is correct in that the
condition cannot happen if the caller is behaving correctly.

In any case it seems that these keys are not supported, so in addition
to fixing the bug you found, we need to add support for them to
cli_ch_esc().


>
> Best regards
>
> Heinrich
>

Regards,
Simon

  reply	other threads:[~2023-01-28 22:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 14:52 [PATCH v3 00/25] bootstd: Add a boot menu Simon Glass
2023-01-06 14:52 ` [PATCH v3 01/25] sandbox: Enable mmc command and legacy images Simon Glass
2023-01-06 14:52 ` [PATCH v3 02/25] cli: Move readline character-processing to a state machine Simon Glass
2023-01-06 15:50   ` Heinrich Schuchardt
2023-01-07  0:13     ` Simon Glass
2023-01-07 22:31       ` Heinrich Schuchardt
2023-01-24 15:19   ` [BUG] " Heinrich Schuchardt
2023-01-28 22:01     ` Simon Glass [this message]
2023-01-06 14:52 ` [PATCH v3 03/25] bootmenu: Add a few comments Simon Glass
2023-01-06 15:53   ` Heinrich Schuchardt
2023-01-07  0:13     ` Simon Glass
2023-01-07 22:34       ` Heinrich Schuchardt
2023-01-07 22:54         ` Simon Glass
2023-01-06 14:52 ` [PATCH v3 04/25] menu: Rename KEY_... to BKEY_ Simon Glass
2023-01-06 14:52 ` [PATCH v3 05/25] menu: Update bootmenu_autoboot_loop() to return the code Simon Glass
2023-01-06 14:52 ` [PATCH v3 06/25] menu: Update bootmenu_loop() " Simon Glass
2023-01-06 14:52 ` [PATCH v3 07/25] menu: Use a switch statement Simon Glass
2023-01-06 14:52 ` [PATCH v3 08/25] menu: Make use of CLI character processing Simon Glass
2023-04-11 20:19   ` Daniel Golle
2023-04-19  1:49     ` Simon Glass
2023-04-24  1:49       ` Tom Rini
2023-04-24 19:42         ` Simon Glass
2023-01-06 14:52 ` [PATCH v3 09/25] image: Add a function to find a script in an image Simon Glass
2023-01-06 14:52 ` [PATCH v3 10/25] image: Move common image code to image_board and command Simon Glass
2023-01-06 14:52 ` [PATCH v3 11/25] video: Enable VIDEO_ANSI by default only with EFI Simon Glass
2023-01-06 14:52 ` [PATCH v3 12/25] video: truetype: Rename the metrics function Simon Glass
2023-01-06 14:52 ` [PATCH v3 13/25] video: Fix unchnaged typo Simon Glass
2023-01-06 14:52 ` [PATCH v3 14/25] video: Add font functions to the vidconsole API Simon Glass
2023-01-06 14:52 ` [PATCH v3 15/25] bootstd: Read the Operating System name for distro/scripts Simon Glass
2023-01-06 14:52 ` [PATCH v3 16/25] bootstd: Allow reading a logo for the OS Simon Glass
2023-01-06 14:52 ` [PATCH v3 17/25] menu: Factor out menu-keypress decoding Simon Glass
2023-01-06 14:52 ` [PATCH v3 18/25] expo: Add basic implementation Simon Glass
2023-01-06 14:52 ` [PATCH v3 19/25] expo: Add support for scenes Simon Glass
2023-01-06 14:52 ` [PATCH v3 20/25] expo: Add support for scene menus Simon Glass
2023-01-06 14:52 ` [PATCH v3 21/25] expo: Add basic tests Simon Glass
2023-01-06 14:52 ` [PATCH v3 22/25] bootstd: Support creating a boot menu Simon Glass
2023-01-06 14:52 ` [PATCH v3 23/25] bootstd: Add a test for the bootstd menu Simon Glass
2023-01-06 14:52 ` [PATCH v3 24/25] bootstd: Support setting a theme for the menu Simon Glass
2023-01-06 14:52 ` [PATCH v3 25/25] expo: Add documentation Simon Glass
2023-01-17 13:57 ` [PATCH v3 00/25] bootstd: Add a boot menu Tom Rini

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

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

  git send-email \
    --in-reply-to='CAPnjgZ3eDJ3+Tv7HDD=iYng8DD4_zdn-k-WXtHxXYYhGwaReCQ@mail.gmail.com' \
    --to=sjg@chromium.org \
    --cc=agust@denx.de \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=masahisa.kojima@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.