mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 08:59:56 +02:00
fix minor asan bug; $(<nosuchfile) is no longer a fatal error with errexit enabled; fixes for vi t/T motion commands
This commit is contained in:
@@ -5944,3 +5944,28 @@ builtins/times.h
|
||||
- add prototypes for functions taking clock_t and timeval, make their
|
||||
declaration in externs.h conditional on NEED_CLOCK_FUNCS_DECL and
|
||||
NEED_TIMEVAL_FUNCS_DECL, respectively
|
||||
|
||||
3/31
|
||||
----
|
||||
subst.c
|
||||
- expand_string_dollar_quote: check for zero-length return from
|
||||
string_extract_{single,double}_quoted and avoid size_t underflow
|
||||
Fixes asan error reported by Grisha Levit <grishalevit@gmail.com>
|
||||
|
||||
4/3
|
||||
---
|
||||
builtins/evalstring.c
|
||||
- open_redir_file: treat the case of failing to open the file as a
|
||||
non-fatal expansion error instead of a (fatal) redirection error.
|
||||
Report from Zev Weiss <zev@bewilderbeest.net>
|
||||
|
||||
4/4
|
||||
---
|
||||
lib/readline/vi_mode.c
|
||||
- _rl_domove_motion_cleanup: d/D require the same special case as c/C
|
||||
so that a motion command that doesn't move the cursor consumes/deletes
|
||||
at least one character.
|
||||
From Emanuele Torre <torreemanuele6@gmail.com>
|
||||
- _rl_domove_motion_cleanup: ditto for y/Y
|
||||
- rl_domove_motion_callback: if t/T/;/, fail (return non-zero without
|
||||
moving point), flag the motion command as having failed (MOVE_FAILED)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -756,7 +756,7 @@ open_redir_file (REDIRECT *r, char **fnp)
|
||||
fd = open(fn, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
file_error (fn);
|
||||
internal_error ("%s: %s", fn, strerror (errno));
|
||||
free (fn);
|
||||
if (fnp)
|
||||
*fnp = 0;
|
||||
|
||||
+26
-1
@@ -1153,6 +1153,23 @@ _rl_mvcxt_dispose (_rl_vimotion_cxt *m)
|
||||
xfree (m);
|
||||
}
|
||||
|
||||
static inline int
|
||||
vi_charsearch_command (int c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'f':
|
||||
case 'F':
|
||||
case 't':
|
||||
case 'T':
|
||||
case ';':
|
||||
case ',':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
rl_domove_motion_callback (_rl_vimotion_cxt *m)
|
||||
{
|
||||
@@ -1173,7 +1190,7 @@ rl_domove_motion_callback (_rl_vimotion_cxt *m)
|
||||
/* Note in the context that the motion command failed. Right now we only do
|
||||
this for unsuccessful searches (ones where _rl_dispatch returns non-zero
|
||||
and point doesn't move). */
|
||||
if (r != 0 && rl_point == opoint && (c == 'f' || c == 'F'))
|
||||
if (r != 0 && rl_point == opoint && vi_charsearch_command (c))
|
||||
m->flags |= MOVE_FAILED;
|
||||
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
@@ -1211,6 +1228,14 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
|
||||
didn't delete anything, as long as the motion command is valid. */
|
||||
if (_rl_to_upper (m->key) == 'C' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0)
|
||||
return (vidomove_dispatch (m));
|
||||
/* 'd' and 'D' must delete at least one character even if the motion
|
||||
command doesn't move the cursor. */
|
||||
if (_rl_to_upper (m->key) == 'D' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0)
|
||||
return (vidomove_dispatch (m));
|
||||
/* 'y' and 'Y' must yank at least one character even if the motion
|
||||
command doean't move the cursor. */
|
||||
if (_rl_to_upper (m->key) == 'Y' && _rl_vi_motion_command (c) && (m->flags & MOVE_FAILED) == 0)
|
||||
return (vidomove_dispatch (m));
|
||||
RL_UNSETSTATE (RL_STATE_VIMOTION);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ getdtablesize (void)
|
||||
# undef bcopy
|
||||
# endif
|
||||
void
|
||||
bcopy (void *s, *d, size_t n)
|
||||
bcopy (void *s, void *d, size_t n)
|
||||
{
|
||||
FASTCOPY (s, d, n);
|
||||
}
|
||||
|
||||
@@ -4063,7 +4063,7 @@ char *
|
||||
expand_string_dollar_quote (const char *string, int flags)
|
||||
{
|
||||
size_t slen, retind, retsize;
|
||||
int sindex, c, peekc, news;
|
||||
int sindex, c, peekc, news, tlen;
|
||||
char *ret, *trans, *t;
|
||||
size_t translen;
|
||||
const char *send;
|
||||
@@ -4100,7 +4100,7 @@ expand_string_dollar_quote (const char *string, int flags)
|
||||
news = skip_single_quoted (string, slen, ++sindex, SX_COMPLETE);
|
||||
else
|
||||
news = skip_double_quoted (string, slen, ++sindex, SX_COMPLETE);
|
||||
translen = news - sindex - 1;
|
||||
translen = (news > sindex) ? news - sindex - 1 : 0;
|
||||
RESIZE_MALLOCED_BUFFER (ret, retind, translen + 3, retsize, 64);
|
||||
ret[retind++] = c;
|
||||
if (translen > 0)
|
||||
|
||||
Reference in New Issue
Block a user