Skip to content
Snippets Groups Projects
Commit 43a8331c authored by Sertonix's avatar Sertonix Committed by Natanael Copa
Browse files

main/busybox: fix some tab completions written to stdout

Most tab completions are written to stderr but some were written to stdout
which sometimes lead to output written in the wrong places.

Fixes #16566
parent 01b20123
No related branches found
No related tags found
1 merge request!74421main/busybox: fix some tab completions written to stdout
Pipeline #269817 skipped
From 9da8d772bafb45b04c34b9901b1c16ad0e439ac5 Mon Sep 17 00:00:00 2001
From: Sertonix <sertonix@posteo.net>
Date: Wed, 30 Oct 2024 14:09:36 +0100
Subject: [PATCH] lineedit: fix some tab completions written to stdout
In fd47f056765 (lineedit: print prompt and editing operations to stderr)
some output was left printing to stdout. This can 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 <sertonix@posteo.net>
---
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
......@@ -5,7 +5,7 @@
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=busybox
pkgver=1.37.0
pkgrel=3
pkgrel=4
pkgdesc="Size optimized toolbox of many common UNIX utilities"
url="https://busybox.net/"
arch="all"
......@@ -78,6 +78,7 @@ source="https://busybox.net/downloads/busybox-$pkgver.tar.bz2
0029-ash-reject-unknown-long-options.patch
0030-hexdump-Skip-a-single-test-on-big-endian-systems.patch
0031-syslogd-fix-wrong-OPT_locallog-flag-detection.patch
0032-lineedit-fix-some-tab-completions-written-to-stdout.patch
acpid.logrotate
busyboxconfig
......@@ -389,6 +390,7 @@ e2c6367162b886654d64a1988e383c05e2792183265c3542d68e535daa5a9509c3e6a42b9aad0367
d9625580bdfe7036e0a3e01c33ddffcc8c70737dfa031c9f97a5a45635910dbd5cf3ebb8d28256a10ee7a13efa1e396a93404099db7a5143adf924a953d4cbe7 0029-ash-reject-unknown-long-options.patch
3b9542d3ec24d9d3fd12b69f60ca1014b49240b92d8517e4467f62b0e266102a73cdac784766a5548a909e08a497c577b1e880604d1859eee18ac455d8bc56b2 0030-hexdump-Skip-a-single-test-on-big-endian-systems.patch
4c2b7d7c623b318087f20b0bef9140cfa3f83111bfc922bba50ddd16edb8844c848c8b93c5d31303b7f253673fbff8ccf3d4ab4b9dad52fde3e04744b0782170 0031-syslogd-fix-wrong-OPT_locallog-flag-detection.patch
f3019d33978fefab027f61cb3181d0cfa9f81463f5ca2a4c84113085e2e262eeecef53d8c731ffe862e2e90857f62214f3b9a4b35203eae30f9e761e2132c1d3 0032-lineedit-fix-some-tab-completions-written-to-stdout.patch
aa93095e20de88730f526c6f463cef711b290b9582cdbd8c1ba2bd290019150cbeaa7007c2e15f0362d5b9315dd63f60511878f0ea05e893f4fdfb4a54af3fb1 acpid.logrotate
94007c258297beb756b7668af94f4818c598456ff337919d8f1260ebf1616c7b0016c2cf04bf8d2428f2c307d30816b523308509770d1aae67fdd87c29a360fa busyboxconfig
9b399cf4bb9dc438c238d7294aef8a7452d9a2b74ff4c09a1349e74e457523329b32042ce86e7dedb99906011022dfd631074a836c897082cbe88c9ae19fe1d4 busyboxconfig-extras
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment