From: Chet Ramey Date: Mon, 11 Feb 2019 14:55:35 +0000 (-0500) Subject: commit bash-20190207 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=439b8c2c5f2981425aad0f0c70a80319f4eb5215;p=thirdparty%2Fbash.git commit bash-20190207 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index e56fb5c6a..757f511d1 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -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 + + + 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 + - 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 diff --git a/Makefile.in b/Makefile.in index a1f6c8076..2a83c4b7f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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} diff --git a/builtins/complete.def b/builtins/complete.def index 6bc3087c5..ae1101097 100644 --- a/builtins/complete.def +++ b/builtins/complete.def @@ -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); diff --git a/builtins/exec.def b/builtins/exec.def index d4670673c..ba5cb1127 100644 --- a/builtins/exec.def +++ b/builtins/exec.def @@ -52,6 +52,8 @@ $END # include #endif +#include + #include "../bashansi.h" #include "../bashintl.h" diff --git a/lib/readline/bind.c b/lib/readline/bind.c index 57ae10f73..6ba98920c 100644 --- a/lib/readline/bind.c +++ b/lib/readline/bind.c @@ -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; } diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c index dc64bde1c..a8a92aa36 100644 --- a/lib/readline/histfile.c +++ b/lib/readline/histfile.c @@ -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 */ } diff --git a/test.c b/test.c index f007be8fe..aba8e216c 100644 --- a/test.c +++ b/test.c @@ -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)) {