diff mbox series

[BlueZ] shared/shell: add proper line clean to bt_shell_printf

Message ID 20250117180611.14869-1-hitechshell@mail.ru (mailing list archive)
State New
Headers show
Series [BlueZ] shared/shell: add proper line clean to bt_shell_printf | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch warning CheckSparse WARNING src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Denis Burkov Jan. 17, 2025, 6:06 p.m. UTC
---
 src/shared/shell.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Denis Burkov Jan. 17, 2025, 6:17 p.m. UTC | #1
in some terminals (or all?) the line is not cleared before a new one is output
(for example, if you turn on scanning and then try to write something to the terminal,
the output will be mixed - you will get something like this

[JBL T450BT]# h[NEW] Device ****
[JBL T450BT]# he[NEW] Device ****
[JBL T450BT]# hell[NEW] Device ****
[JBL T450BT]# hello[NEW] Device ****
[JBL T450BT]# hello[NEW] Device ****

where "Device ****" is the line that was actually fed to bt_shell_printf
Luiz Augusto von Dentz Jan. 17, 2025, 6:17 p.m. UTC | #2
Hi Denis,

On Fri, Jan 17, 2025 at 1:08 PM Denis Burkov <hitechshell@mail.ru> wrote:

We normally expect some description of why this change is required,
for instance what is the output with and without your changes here,
are there artifacts if we don't use rl_clear_visible_line?

> ---
>  src/shared/shell.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/shared/shell.c b/src/shared/shell.c
> index aa6c16c8c..837152525 100644
> --- a/src/shared/shell.c
> +++ b/src/shared/shell.c
> @@ -719,6 +719,7 @@ void bt_shell_printf(const char *fmt, ...)
>                 saved_line = rl_copy_text(0, rl_end);
>                 if (!data.saved_prompt)
>                         rl_save_prompt();
> +               rl_clear_visible_line();
>                 rl_reset_line_state();
>         }
>
> --
> 2.45.2
>
>
Denis Burkov Jan. 17, 2025, 6:25 p.m. UTC | #3
On Fri, Jan 17, 2025 at 01:17:31PM -0500, Luiz Augusto von Dentz wrote:
> Hi Denis,
> 
> On Fri, Jan 17, 2025 at 1:08 PM Denis Burkov <hitechshell@mail.ru> wrote:
> 
> We normally expect some description of why this change is required,
> for instance what is the output with and without your changes here,
> are there artifacts if we don't use rl_clear_visible_line?

in some terminals (or all?) the line is not cleared before a new one is output
(for example, if you turn on scanning and then try to write something to the terminal,
the output will be mixed - you will get something like this

[JBL T450BT]# h[NEW] Device ****
[JBL T450BT]# he[NEW] Device ****
[JBL T450BT]# hell[NEW] Device ****
[JBL T450BT]# hello[NEW] Device ****
[JBL T450BT]# hello[NEW] Device ****

where "Device ****" is the line that was actually fed to bt_shell_printf

this was reproduced at least on simple terminal and alacritty (on gentoo)
Denis Burkov Jan. 17, 2025, 6:51 p.m. UTC | #4
Issue was reporduced on:
PostmarketOS (gnome-terminal)
Archlinux (konsole, alacritty)
Gentoo (simple terminal, alacritty)

(this list is not complete - only those systems/terminals that I had
quick access to)
bluez.test.bot@gmail.com Jan. 17, 2025, 7:15 p.m. UTC | #5
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=926556

---Test result---

Test Summary:
CheckPatch                    PENDING   0.25 seconds
GitLint                       PENDING   0.27 seconds
BuildEll                      PASS      20.39 seconds
BluezMake                     PASS      1474.80 seconds
MakeCheck                     PASS      13.32 seconds
MakeDistcheck                 PASS      159.58 seconds
CheckValgrind                 PASS      212.01 seconds
CheckSmatch                   WARNING   269.32 seconds
bluezmakeextell               PASS      98.06 seconds
IncrementalBuild              PENDING   0.29 seconds
ScanBuild                     PASS      851.99 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index aa6c16c8c..837152525 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -719,6 +719,7 @@  void bt_shell_printf(const char *fmt, ...)
 		saved_line = rl_copy_text(0, rl_end);
 		if (!data.saved_prompt)
 			rl_save_prompt();
+		rl_clear_visible_line();
 		rl_reset_line_state();
 	}