mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-09 03:30:48 +02:00
fix issue with interupting timed functions; fix for parsing comsubs inside arith for commands; allow break and continue inside arith for expressions; fix for case-insensitive completion with multibyte chars; fix some minor memory leaks; reset read buffer if it returns partial results on EINTR; fix for undo in execute-named-command
This commit is contained in:
+14
-5
@@ -77,6 +77,10 @@ extern int errno;
|
||||
# include "colors.h"
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) < (y)) ? (x): (y))
|
||||
#endif
|
||||
|
||||
typedef int QSFUNC (const void *, const void *);
|
||||
|
||||
#ifdef HAVE_LSTAT
|
||||
@@ -1355,6 +1359,7 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
|
||||
int low; /* Count of max-matched characters. */
|
||||
int lx;
|
||||
char *dtext; /* dequoted TEXT, if needed */
|
||||
size_t si1, si2;
|
||||
size_t len1, len2;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
int v;
|
||||
@@ -1385,7 +1390,7 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
|
||||
len1 = strlen (match_list[i]);
|
||||
len2 = strlen (match_list[i + 1]);
|
||||
|
||||
for (si = 0; (c1 = match_list[i][si]) && (c2 = match_list[i + 1][si]); si++)
|
||||
for (si1 = si2 = 0; (c1 = match_list[i][si1]) && (c2 = match_list[i + 1][si2]); si1++,si2++)
|
||||
{
|
||||
if (_rl_completion_case_fold)
|
||||
{
|
||||
@@ -1395,8 +1400,8 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
v1 = MBRTOWC (&wc1, match_list[i]+si, len1 - si, &ps1);
|
||||
v2 = MBRTOWC (&wc2, match_list[i+1]+si, len2 - si, &ps2);
|
||||
v1 = MBRTOWC (&wc1, match_list[i]+si1, len1 - si1, &ps1);
|
||||
v2 = MBRTOWC (&wc2, match_list[i+1]+si2, len2 - si2, &ps2);
|
||||
if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2))
|
||||
{
|
||||
if (c1 != c2) /* do byte comparison */
|
||||
@@ -1410,8 +1415,11 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
|
||||
}
|
||||
if (wc1 != wc2)
|
||||
break;
|
||||
else if (v1 > 1)
|
||||
si += v1 - 1;
|
||||
|
||||
if (v1 > 1)
|
||||
si1 += v1 - 1;
|
||||
if (v2 > 1)
|
||||
si2 += v2 - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -1419,6 +1427,7 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
|
||||
break;
|
||||
}
|
||||
|
||||
si = MIN (si1, si2); /* use shorter of matches of different length */
|
||||
if (low > si)
|
||||
low = si;
|
||||
}
|
||||
|
||||
@@ -2011,9 +2011,7 @@ _rl_readstr_init (int pchar, int flags)
|
||||
|
||||
cxt = _rl_rscxt_alloc (flags);
|
||||
|
||||
rl_maybe_replace_line ();
|
||||
_rl_saved_line_for_readstr = _rl_alloc_saved_line ();
|
||||
|
||||
rl_undo_list = 0;
|
||||
|
||||
rl_line_buffer[0] = 0;
|
||||
|
||||
+9
-2
@@ -41,13 +41,16 @@ extern int errno;
|
||||
# define ZBUFSIZ 4096
|
||||
#endif
|
||||
|
||||
extern int executing_builtin;
|
||||
extern int executing_builtin, interrupt_state;
|
||||
|
||||
extern void check_signals_and_traps (void);
|
||||
extern void check_signals (void);
|
||||
extern int signal_is_trapped (int);
|
||||
extern int read_builtin_timeout (int);
|
||||
|
||||
/* Forward declarations */
|
||||
void zreset (void);
|
||||
|
||||
/* Read LEN bytes from FD into BUF. Retry the read on EINTR. Any other
|
||||
error causes the loop to break. */
|
||||
ssize_t
|
||||
@@ -66,7 +69,11 @@ zread (int fd, char *buf, size_t len)
|
||||
/* XXX - bash-5.0 */
|
||||
/* We check executing_builtin and run traps here for backwards compatibility */
|
||||
if (executing_builtin)
|
||||
check_signals_and_traps (); /* XXX - should it be check_signals()? */
|
||||
{
|
||||
if (interrupt_state)
|
||||
zreset ();
|
||||
check_signals_and_traps (); /* XXX - should it be check_signals()? */
|
||||
}
|
||||
else
|
||||
check_signals ();
|
||||
errno = t;
|
||||
|
||||
Reference in New Issue
Block a user