In fd47f056765 (lineedit: print prompt and editing operations to stderr) some output was left printing to stdout. This causes a race condition between stderr and stdout which in some cases leads to output written in the wrong places.
Downstream issue: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16566 Fixes: fd47f056765 Signed-off-by: Sertonix <[email protected]> --- libbb/lineedit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 151208c1c..066087364 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -451,7 +451,7 @@ static void put_cur_glyph_and_inc_cursor(void) * have automargin (IOW: it is moving cursor to next line * by itself (which is wrong for VT-10x terminals)), * this will break things: there will be one extra empty line */ - puts("\r"); /* + implicit '\n' */ + bb_putchar_stderr('\r'); /* + implicit '\n' */ #else /* VT-10x terminals don't wrap cursor to next line when last char * on the line is printed - cursor stays "over" this char. @@ -1170,9 +1170,9 @@ static void showfiles(void) ); } if (ENABLE_UNICODE_SUPPORT) - puts(printable_string(matches[n])); + fprintf(stderr, "%s\n", printable_string(matches[n])); else - puts(matches[n]); + fprintf(stderr, "%s\n", matches[n]); } } -- 2.46.2 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
