mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] busybox: add lineedit patches
Date: Thu, 17 Apr 2025 11:10:36 +0200	[thread overview]
Message-ID: <20250417091036.3758538-1-m.grzeschik@pengutronix.de> (raw)

In busybox the tabcompletion was broken. With the recent patches this is
fixed.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 ...printing-lines-during-tab-completion.patch | 37 +++++++++++++++++++
 ...needit-fix-left-over-print-to-stdout.patch | 33 +++++++++++++++++
 patches/busybox-1.37.0/series                 |  4 +-
 3 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 patches/busybox-1.37.0/0204-lineedit-fix-printing-lines-during-tab-completion.patch
 create mode 100644 patches/busybox-1.37.0/0205-lineedit-fix-left-over-print-to-stdout.patch

diff --git a/patches/busybox-1.37.0/0204-lineedit-fix-printing-lines-during-tab-completion.patch b/patches/busybox-1.37.0/0204-lineedit-fix-printing-lines-during-tab-completion.patch
new file mode 100644
index 000000000..d9864d8d7
--- /dev/null
+++ b/patches/busybox-1.37.0/0204-lineedit-fix-printing-lines-during-tab-completion.patch
@@ -0,0 +1,37 @@
+From c443f2d2c67b5e5080632819980799c55b7bb89f Mon Sep 17 00:00:00 2001
+From: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Date: Thu, 17 Apr 2025 11:00:43 +0200
+Subject: [PATCH 1/2] lineedit: fix printing lines during tab completion
+
+Indentation and escape characters are all output to stderr now, but the
+matches themself remained on stdout leading to garbled output on Tab
+completion.
+
+Print the results to stderr as well to fix this.
+
+Fixes: fd47f056765a ("lineedit: print prompt and editing operations to stderr")
+Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
+---
+ libbb/lineedit.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/libbb/lineedit.c b/libbb/lineedit.c
+index 543a3f11c3e4..1f4b011008b6 100644
+--- a/libbb/lineedit.c
++++ b/libbb/lineedit.c
+@@ -1170,9 +1170,10 @@ static void showfiles(void)
+ 			);
+ 		}
+ 		if (ENABLE_UNICODE_SUPPORT)
+-			puts(printable_string(matches[n]));
++			fputs(printable_string(matches[n]), stderr);
+ 		else
+-			puts(matches[n]);
++			fputs(matches[n], stderr);
++		bb_putchar_stderr('\n');
+ 	}
+ }
+ 
+-- 
+2.39.5
+
diff --git a/patches/busybox-1.37.0/0205-lineedit-fix-left-over-print-to-stdout.patch b/patches/busybox-1.37.0/0205-lineedit-fix-left-over-print-to-stdout.patch
new file mode 100644
index 000000000..6c0d00e18
--- /dev/null
+++ b/patches/busybox-1.37.0/0205-lineedit-fix-left-over-print-to-stdout.patch
@@ -0,0 +1,33 @@
+From 40a8532dea18363fb67466e1b02651cc964017e8 Mon Sep 17 00:00:00 2001
+From: Ahmad Fatoum <a.fatoum@pengutronix.de>
+Date: Thu, 17 Apr 2025 11:00:43 +0200
+Subject: [PATCH 2/2] lineedit: fix left-over print to stdout
+
+There's code printing to stderr both before and after the single call to
+puts inside put_cur_glyph_and_inc_cursor().
+
+This is likely an oversight as we want everything to go through the
+same file descriptor, so switch it over to fputs.
+
+Fixes: fd47f056765a ("lineedit: print prompt and editing operations to stderr")
+Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
+---
+ libbb/lineedit.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libbb/lineedit.c b/libbb/lineedit.c
+index 1f4b011008b6..206fc36ef5c0 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' */
++		fputs("\r\n", stderr);
+ #else
+ 		/* VT-10x terminals don't wrap cursor to next line when last char
+ 		 * on the line is printed - cursor stays "over" this char.
+-- 
+2.39.5
+
diff --git a/patches/busybox-1.37.0/series b/patches/busybox-1.37.0/series
index 87fee5091..f403c5683 100644
--- a/patches/busybox-1.37.0/series
+++ b/patches/busybox-1.37.0/series
@@ -7,4 +7,6 @@
 0201-build-system-only-pass-real-libs-to-SELINUX_LIBS.patch
 0202-scripts-trylink-honour-SKIP_STRIP-and-don-t-strip-if.patch
 0203-tc-Fix-compilation-with-Linux-v6.8-rc1.patch
-# e781b8c6838e27fd021f9c1a9f87654d  - git-ptx-patches magic
+0204-lineedit-fix-printing-lines-during-tab-completion.patch
+0205-lineedit-fix-left-over-print-to-stdout.patch
+# de06cc1132910215a67ae025e9b0aaa9  - git-ptx-patches magic
-- 
2.39.5




                 reply	other threads:[~2025-04-17  9:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250417091036.3758538-1-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox