commit bash-20190207 snapshot

This commit is contained in:
Chet Ramey
2019-02-11 09:55:35 -05:00
parent 38f8cb6930
commit 439b8c2c5f
7 changed files with 68 additions and 16 deletions
+25
View File
@@ -5205,3 +5205,28 @@ lib/readline/readline.c
sure that the history position is at the end of the history before
calling _rl_revert_all_lines(). Fixes bug reported by
johnlinp@gmail.com and frederik@ofb.net
2/4
---
builtins/complete.def
- complete_builtin: fix check for argument to -F to use strpbrk
instead of incomplete use of strcspn. Fix from Grisha Levit
<grishalevit@gmail.com>
2/5
---
lib/readline/readline.c
- rl_parse_and_bind: change parsing of boolean variable values to
look for and consume an optional whitespace-delimited word. This
allows trailing spaces and everything that follows to work. Idea
from Bize Ma <binaryzebra@gmail.com>
- rl_parse_and_bind: print error message about unknown variable names
instead of calling rl_variable_bind to do it
- rl_variable_bind: report error if setting string variable returns
non-zero
2/6
---
lib/readline/histfile.c
- read_history_range: close FILE before returning if the history file
size is 0
+1 -1
View File
@@ -691,7 +691,7 @@ $(SHLIB_LIBRARY): config.h ${SHLIB_SOURCE}
${INTL_LIBRARY}: config.h ${INTL_LIBDIR}/Makefile
@echo making $@ in ${INTL_LIBDIR}
@(cd ${INTL_LIBDIR} && \
$(MAKE) $(MFLAGS) all) || exit 1
$(MAKE) $(MFLAGS) XCFLAGS="${LOCAL_CFLAGS}" all) || exit 1
${LIBINTL_H}: ${INTL_DEP}
+1 -1
View File
@@ -326,7 +326,7 @@ build_actions (list, flagp, actp, optp)
case 'F':
w.word = Farg = list_optarg;
w.flags = 0;
if (check_identifier (&w, posixly_correct) == 0 || strcspn (Farg, shell_break_chars))
if (check_identifier (&w, posixly_correct) == 0 || strpbrk (Farg, shell_break_chars) != 0)
{
sh_invalidid (Farg);
return (EX_USAGE);
+2
View File
@@ -52,6 +52,8 @@ $END
# include <unistd.h>
#endif
#include <stdio.h>
#include "../bashansi.h"
#include "../bashintl.h"
+27 -14
View File
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -1569,15 +1569,11 @@ rl_parse_and_bind (char *string)
/* Strip trailing whitespace from values of boolean variables. */
if (find_boolean_var (var) >= 0)
{
/* remove trailing whitespace */
remove_trailing:
e = value + strlen (value) - 1;
while (e >= value && whitespace (*e))
e--;
e++; /* skip back to whitespace or EOS */
if (*e && e >= value)
*e = '\0';
/* just read a whitespace-delimited word or empty string */
for (e = value; *e && whitespace (*e) == 0; e++)
;
if (e > value)
*e = '\0'; /* cut off everything trailing */
}
else if ((i = find_string_var (var)) >= 0)
{
@@ -1589,9 +1585,24 @@ remove_trailing:
value++; /* skip past the quote */
}
else
goto remove_trailing;
{
/* remove trailing whitespace */
e = value + strlen (value) - 1;
while (e >= value && whitespace (*e))
e--;
e++; /* skip back to whitespace or EOS */
if (*e && e >= value)
*e = '\0';
}
}
else
{
/* avoid calling rl_variable_bind just to find this out */
_rl_init_file_error ("%s: unknown variable name", var);
return 1;
}
rl_variable_bind (var, value);
return 0;
}
@@ -1903,7 +1914,7 @@ string_varname (int i)
}
/* A boolean value that can appear in a `set variable' command is true if
the value is null or empty, `on' (case-insensitive), or "1". Any other
the value is null or empty, `on' (case-insensitive), or "1". All other
values result in 0 (false). */
static int
bool_to_int (const char *value)
@@ -1928,7 +1939,7 @@ rl_variable_value (const char *name)
return (_rl_get_string_variable_value (string_varlist[i].name));
/* Unknown variable names return NULL. */
return 0;
return (char *)NULL;
}
int
@@ -1959,6 +1970,8 @@ rl_variable_bind (const char *name, const char *value)
}
v = (*string_varlist[i].set_func) (value);
if (v != 0)
_rl_init_file_error ("%s: could not set value to `%s'", name, value);
return v;
}
+1
View File
@@ -305,6 +305,7 @@ read_history_range (const char *filename, int from, int to)
if (file_size == 0)
{
free (input);
close (file);
return 0; /* don't waste time if we don't have to */
}
+11
View File
@@ -633,6 +633,17 @@ unary_test (op, arg)
free (t);
return ret;
}
#if 0 /* TAG:bash-5.1 */
else if (legal_number (arg, &r)) /* -v n == is $n set? */
{
char *t;
int ret;
t = get_dollar_var_value (r);
ret = t ? TRUE : FALSE;
free (t);
return ret;
}
#endif
v = find_variable (arg);
if (v && invisible_p (v) == 0 && array_p (v))
{