Files
packages/utils/bash/patches/017-bash_5.3_patch_18.patch
Wei-Ting Yang 6fd88543e2 bash: update to 5.3 patch level 20
- Accommodate macOS dynamic pipe sizing, avoiding hangs.
- Modify the readline redisplay code to use a buffer offset instead of
  the physical prompt length in a multibyte locale to determine whether
  to reprint the prompt from column 0 because the cursor is before the
  last invisible character in the prompt string.
- Fix readline crash with a prompt that exceeds 256 wrapped lines.
  Fix readline redisplay code to print the entire prompt if the first
  few characters are identical but part of a terminal escape sequence
  and the prompt needs to be redrawn.
- Work around systems including bytes between 128 and 255 in the
  isalpha(3) set, which causes bash to potentially include them in
  identifier names.
- If readline handles a SIGWINCH and updates its idea of the screen
  dimensions, it needs to recompute the columns where the prompt wraps
  lines every time, not just when the screen width decreases.

Signed-off-by: Wei-Ting Yang <williamatcg@gmail.com>
2026-09-16 18:53:00 +03:00

44 lines
1.7 KiB
Diff

From 49502f0cdd1331d73e8747552d791aea31706784 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Tue, 15 Sep 2026 11:15:57 -0400
Subject: Bash-5.3 patch 18: fix readline crash with a prompt that exceeds 256
wrapped lines; fix readline redisplay code to print the entire prompt if the
first few characters are identical but part of a terminal escape sequence and
the prompt needs to be redrawn.
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -1024,6 +1024,7 @@ rl_redisplay (void)
while (local_prompt_newlines[newlines+1] != -1)
{
temp = local_prompt_newlines[newlines+1];
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = temp;
}
@@ -2261,11 +2262,12 @@ update_line (char *old, char *old_face,
od = ofd - old; /* index of first difference in visible line */
nd = nfd - new; /* nd, od are buffer indexes */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
- _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
+ _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos >= 0 &&
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
- _rl_cr ();
+ if (_rl_last_c_pos > 0)
+ _rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 17
+#define PATCHLEVEL 18
#endif /* _PATCHLEVEL_H_ */