[PATCH 1/1] common: remove "impossible condition #876" message

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;

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

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

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
participants (2)
-
Heinrich Schuchardt
-
Simon Glass