]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20190207 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 11 Feb 2019 14:55:35 +0000 (09:55 -0500)
committerChet Ramey <chet.ramey@case.edu>
Mon, 11 Feb 2019 14:55:35 +0000 (09:55 -0500)
CWRU/CWRU.chlog
Makefile.in
builtins/complete.def
builtins/exec.def
lib/readline/bind.c
lib/readline/histfile.c
test.c

index e56fb5c6aa1b4d48e041e8c3b56466448e5f18c5..757f511d108593bd9b187554a502d608af91b179 100644 (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
index a1f6c807654f68a2bd3da7fe196ded70d2b2abb1..2a83c4b7fa9b6be5e777aadc9e7b015712eb9e43 100644 (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}
 
index 6bc3087c5b8eed176f8858c51f218d8644665576..ae1101097f2720866f4b2fca912b29a72652c84a 100644 (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);
index d4670673c7706e32fdb905115b5d1b87585fdc6c..ba5cb1127e7663b2b38303149773927b3b833542 100644 (file)
@@ -52,6 +52,8 @@ $END
 #  include <unistd.h>
 #endif
 
+#include <stdio.h>
+
 #include "../bashansi.h"
 #include "../bashintl.h"
 
index 57ae10f7318e521797fb4b8f7e426c7ab1324a49..6ba98920c815fcc98907ff41f7f7c1b282355f1a 100644 (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;
 }
 
index dc64bde1c5acf8c117080eb7c783a2cd3181311d..a8a92aa3604a52216ff29a353e282482d80c4184 100644 (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 */
     }
 
diff --git a/test.c b/test.c
index f007be8fe434bd621e2799a8d923e2c5bd70f981..aba8e216c1e5a37c834c5b2ee78388f921efcc74 100644 (file)
--- 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))
        {