2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-12-22 07:10:16 -07:00

busybox: ash fix line in term resize and patching

This commit is contained in:
Rohan 2024-03-23 11:06:50 -04:00 committed by git-bruh
parent 9e00a7f00f
commit a7ba61c545
No known key found for this signature in database
4 changed files with 64 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh -e
for patch in patch/*.patch; do
for patch in *.patch; do
patch -p1 < "$patch"
done

View File

@ -8,6 +8,7 @@ fd866b53f9d1ca305c15b93bc2699caaf1c930f093326bb737cc33fa2455787e00
830b9252cbb017d3a2e31e0a38171d23dac199353179b79f27dbbdc7e924d708d6
ac7b8b37fb4f713d2b9816ac65201b5fd728971ac5fc8c0f020a319aa9f7610afc
473bf2b8963fb8fc28fd05edc36d610606f77a6f34f652e951e3f68a8473ba4913
7750b80df9d3f5b09464aee88bb2cba0f63be662fa587f04185970b9afcab1d47f
a76533bec15f766a6ccc0ae644316a5f5f2a0d2fccc2d665612422190598c926fe
88d4564c6f2a39cae3d9ea559e23ce778d3688dfca054abd66c2174e6f88c797f6
cd1b92ae0db6357b11e1669e8866b9cff94522087cfa146ca192000bee07d9042d

View File

@ -0,0 +1,61 @@
From 63bb934c9e48d3ba1dc7f8001d423ea84b9a00c2 Mon Sep 17 00:00:00 2001
From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Date: Thu, 19 Jan 2023 17:18:18 +0100
Subject: [PATCH] lineedit: Handle SIGWINCH gracefully
Since 1.16.0 a resize of the terminal emulator resulted in ash printing
a new command line. This fixes the issue by retrying read_key() in
lineedit_read_key() on SIGWINCH, rendering reception of SIGWINCH
transparent to callers of read_line_input().
Fixes https://bugs.busybox.net/show_bug.cgi?id=15256
---
libbb/lineedit.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d6b2e76ff..a47d9e508 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2149,7 +2149,7 @@ static void cmdedit_setwidth(void)
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor);
}
-static void win_changed(int nsig UNUSED_PARAM)
+static void win_changed(int nsig)
{
if (S.ok_to_redraw) {
/* We are in read_key(), safe to redraw immediately */
@@ -2157,6 +2157,7 @@ static void win_changed(int nsig UNUSED_PARAM)
cmdedit_setwidth();
fflush_all();
errno = sv_errno;
+ bb_got_signal = nsig;
} else {
/* Signal main loop that redraw is necessary */
S.SIGWINCH_count++;
@@ -2186,7 +2187,9 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
* Note: read_key sets errno to 0 on success.
*/
for (;;) {
- if ((state->flags & LI_INTERRUPTIBLE) && bb_got_signal) {
+ if ((state->flags & LI_INTERRUPTIBLE) && bb_got_signal
+ && (bb_got_signal != SIGWINCH)
+ ) {
errno = EINTR;
return -1;
}
@@ -2197,6 +2200,10 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
IF_FEATURE_EDITING_WINCH(S.ok_to_redraw = 0;)
if (errno != EINTR)
break;
+ if (bb_got_signal == SIGWINCH) {
+ bb_got_signal = 0;
+ continue;
+ }
if (state->flags & LI_INTERRUPTIBLE) {
/* LI_INTERRUPTIBLE bails out on EINTR,
* but nothing really guarantees that bb_got_signal
--
2.39.1

View File

@ -8,6 +8,7 @@ patches/install-fix-chown.patch patch
patches/lsusb-vendor-product.patch patch
patches/unzip-usage-no-error.patch patch
patches/init-use-baseinit.patch patch
patches/lineedit-Handle-SIGWINCH-gracefully.patch
files/.config
files/.config-suid
files/acpid.run