All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] common: remove "impossible condition #876" message
@ 2023-01-29 22:32 Heinrich Schuchardt
  2023-01-30 15:50 ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-01-29 22:32 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot, Heinrich Schuchardt

Function cli_ch_esc() supports only a small subset of the escape sequences
used by terminals. Don't nag the user with a message if an unsupported
escape sequence is met.

Fixes: b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 common/cli_getch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cli_getch.c b/common/cli_getch.c
index 87c23edcf4..ebda3a1236 100644
--- a/common/cli_getch.c
+++ b/common/cli_getch.c
@@ -198,7 +198,7 @@ int cli_ch_process(struct cli_ch_state *cch, int ichar)
 			cch->esc_save[cch->esc_len] = ichar;
 			cch->esc_len = 1;
 		} else {
-			puts("impossible condition #876\n");
+			/* TODO: support more escape sequences */
 			cch->esc_len = 0;
 		}
 		return 0;
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] common: remove "impossible condition #876" message
  2023-01-29 22:32 [PATCH 1/1] common: remove "impossible condition #876" message Heinrich Schuchardt
@ 2023-01-30 15:50 ` Simon Glass
  2023-01-31  1:50   ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2023-01-30 15:50 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot

Hi Heinrich,

On Sun, 29 Jan 2023 at 15:32, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Function cli_ch_esc() supports only a small subset of the escape sequences
> used by terminals. Don't nag the user with a message if an unsupported
> escape sequence is met.
>
> Fixes: b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  common/cli_getch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

The bug is in the calling code, though. See my previous email.

>
> diff --git a/common/cli_getch.c b/common/cli_getch.c
> index 87c23edcf4..ebda3a1236 100644
> --- a/common/cli_getch.c
> +++ b/common/cli_getch.c
> @@ -198,7 +198,7 @@ int cli_ch_process(struct cli_ch_state *cch, int ichar)
>                         cch->esc_save[cch->esc_len] = ichar;
>                         cch->esc_len = 1;
>                 } else {
> -                       puts("impossible condition #876\n");
> +                       /* TODO: support more escape sequences */
>                         cch->esc_len = 0;
>                 }
>                 return 0;
> --
> 2.38.1
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] common: remove "impossible condition #876" message
  2023-01-30 15:50 ` Simon Glass
@ 2023-01-31  1:50   ` Heinrich Schuchardt
  2023-02-05  0:01     ` Simon Glass
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2023-01-31  1:50 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot

On 1/30/23 16:50, Simon Glass wrote:
> Hi Heinrich,
> 
> On Sun, 29 Jan 2023 at 15:32, Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> Function cli_ch_esc() supports only a small subset of the escape sequences
>> used by terminals. Don't nag the user with a message if an unsupported
>> escape sequence is met.
>>
>> Fixes: b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
>> ---
>>   common/cli_getch.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> The bug is in the calling code, though. See my previous email.

Your patch introduced further problems:

b08e9d4b6632 ("cli: Move readline character-processing to a state machine")

At git commit b08e9d4b6632 in sandbox_defconfig at the command line enter

abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>

and you get a crash.

With origin/master at the command line enter

abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>

and the output is:

=> abcimpossible condition #876
~impossible condition #876
~impossible condition #876
~impossible condition #876
~
Unknown command 'abc~~~~' - try 'help'
=>

Before the patch entering

abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>

results in:

=> abc
Unknown command 'abc' - try 'help'
=>

This is what is expected. Please, restore this behavior.

Best regards

Heinrich

> 
>>
>> diff --git a/common/cli_getch.c b/common/cli_getch.c
>> index 87c23edcf4..ebda3a1236 100644
>> --- a/common/cli_getch.c
>> +++ b/common/cli_getch.c
>> @@ -198,7 +198,7 @@ int cli_ch_process(struct cli_ch_state *cch, int ichar)
>>                          cch->esc_save[cch->esc_len] = ichar;
>>                          cch->esc_len = 1;
>>                  } else {
>> -                       puts("impossible condition #876\n");
>> +                       /* TODO: support more escape sequences */
>>                          cch->esc_len = 0;
>>                  }
>>                  return 0;
>> --
>> 2.38.1
>>
> 
> Regards,
> Simon


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] common: remove "impossible condition #876" message
  2023-01-31  1:50   ` Heinrich Schuchardt
@ 2023-02-05  0:01     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2023-02-05  0:01 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: u-boot

Hi Heinrich,

On Mon, 30 Jan 2023 at 18:50, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> On 1/30/23 16:50, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Sun, 29 Jan 2023 at 15:32, Heinrich Schuchardt
> > <heinrich.schuchardt@canonical.com> wrote:
> >>
> >> Function cli_ch_esc() supports only a small subset of the escape sequences
> >> used by terminals. Don't nag the user with a message if an unsupported
> >> escape sequence is met.
> >>
> >> Fixes: b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> >> ---
> >>   common/cli_getch.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > The bug is in the calling code, though. See my previous email.
>
> Your patch introduced further problems:
>
> b08e9d4b6632 ("cli: Move readline character-processing to a state machine")
>
> At git commit b08e9d4b6632 in sandbox_defconfig at the command line enter
>
> abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>
>
> and you get a crash.
>
> With origin/master at the command line enter
>
> abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>
>
> and the output is:
>
> => abcimpossible condition #876
> ~impossible condition #876
> ~impossible condition #876
> ~impossible condition #876
> ~
> Unknown command 'abc~~~~' - try 'help'
> =>
>
> Before the patch entering
>
> abc<PG-UP><PG-DOWN><PG-UP><PG-DOWN><ENTER>
>
> results in:
>
> => abc
> Unknown command 'abc' - try 'help'
> =>
>
> This is what is expected. Please, restore this behavior.

OK thank you for the detailed report. I will send a few patches to fix it

Regards,
Simon


>
> Best regards
>
> Heinrich
>
> >
> >>
> >> diff --git a/common/cli_getch.c b/common/cli_getch.c
> >> index 87c23edcf4..ebda3a1236 100644
> >> --- a/common/cli_getch.c
> >> +++ b/common/cli_getch.c
> >> @@ -198,7 +198,7 @@ int cli_ch_process(struct cli_ch_state *cch, int ichar)
> >>                          cch->esc_save[cch->esc_len] = ichar;
> >>                          cch->esc_len = 1;
> >>                  } else {
> >> -                       puts("impossible condition #876\n");
> >> +                       /* TODO: support more escape sequences */
> >>                          cch->esc_len = 0;
> >>                  }
> >>                  return 0;
> >> --
> >> 2.38.1
> >>
> >
> > Regards,
> > Simon
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-05  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 22:32 [PATCH 1/1] common: remove "impossible condition #876" message Heinrich Schuchardt
2023-01-30 15:50 ` Simon Glass
2023-01-31  1:50   ` Heinrich Schuchardt
2023-02-05  0:01     ` Simon Glass

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.