]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20190306 snapshot
authorChet Ramey <chet.ramey@case.edu>
Thu, 7 Mar 2019 17:08:22 +0000 (12:08 -0500)
committerChet Ramey <chet.ramey@case.edu>
Thu, 7 Mar 2019 17:08:22 +0000 (12:08 -0500)
CWRU/CWRU.chlog
MANIFEST
lib/readline/doc/rltech.texi
lib/readline/doc/version.texi
subst.c
tests/dollar-at-star
tests/dollar-star10.sub [new file with mode: 0644]

index 57f1c618013708387f535443119eb687e327e3ca..cefc5ec4f672facd55b41a7c10df01d1d7a4247e 100644 (file)
@@ -5431,3 +5431,31 @@ examples/loadables/fdflags.c
 execute_cmd.c
        - execute_connection: call optimize_fork on the rhs of a `;' connection
          to attempt to optimize the last simple command in a list
+
+                                   3/4
+                                   ---
+subst.c
+       - parameter_brace_expand: add `@' to the list of operators that cause
+         unbound parameter errors. Fixes oversight bug reported by
+         Martin Schulte <gnu@schrader-schulte.de>
+
+                                   3/5
+                                   ---
+subst.c
+       - expand_word_internal: update to fix from 2/21 and 2/27 to accommodate
+         contexts when word splitting will not take place (W_ASSIGNRHS). Fix
+         from Grisha Levit <grishalevit@gmail.com>
+       - param_expand: if IFS is unset, and we are expanding $* in a context
+         where we're not going to be performing word splitting, just treat it
+         as if IFS=" " and don't set W_SPLITSPACE. Report and hint at fix
+         from Grisha Levit <grishalevit@gmail.com>
+       - param_expand: if IFS is not null, and we are expanding $* in a
+         context where we're not going to be performing word splitting, and
+         we quote a null string (resulting in a quoted null), make sure we
+         set W_SAWQUOTEDNULL to note this for the caller
+       - parameter_brace_expand_rhs: make sure to remove any W_SAWQUOTEDNULL
+         flag for a the word on the rhs of the `=' operator if the original
+         string is null or the original string is not null and the returned
+         string (after dequoting) is not null. For instance ${v= ''} should
+         not have the SAWQUOTEDNULL flag set because it is " " after
+         expansion and dequoting, even though we saw a quoted null there
index afba5ceaee3a9650d5bc18c01dfb345ebfa621b1..dff682475a89ac5369a4617999c334f7ae04744c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1009,6 +1009,7 @@ tests/dollar-star6.sub    f
 tests/dollar-star7.sub f
 tests/dollar-star8.sub f
 tests/dollar-star9.sub f
+tests/dollar-star10.sub        f
 tests/dollar.right     f
 tests/dstack.tests     f
 tests/dstack.right     f
index 28a02d99607344761b34c53f2ebc8b1100a3fe9a..15231392a3eaaab9a91782af9b2e15081da3f771 100644 (file)
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
 in the consistency of user interface across discrete programs that need
 to provide a command line interface.
 
-Copyright (C) 1988--2016 Free Software Foundation, Inc.
+Copyright (C) 1988--2019 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of
 this manual provided the copyright notice and this permission notice
@@ -1733,8 +1733,8 @@ to determine whether or not there are any pending signals.
 
 If an application does not wish Readline to catch @code{SIGWINCH}, it may
 call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force
-Readline to update its idea of the terminal size when a @code{SIGWINCH}
-is received.
+Readline to update its idea of the terminal size when it receives
+a @code{SIGWINCH}.
 
 @deftypefun void rl_echo_signal_char (int sig)
 If an application wishes to install its own signal handlers, but still
@@ -1751,11 +1751,14 @@ Update Readline's internal screen size by reading values from the kernel.
 Set Readline's idea of the terminal size to @var{rows} rows and
 @var{cols} columns.  If either @var{rows} or @var{columns} is less than
 or equal to 0, Readline's idea of that terminal dimension is unchanged.
+This is intended to tell Readline the physical dimensions of the terminal,
+and is used internally to calculate the maximum number of characters that
+may appear on the screen.
 @end deftypefun
 
 If an application does not want to install a @code{SIGWINCH} handler, but
-is still interested in the screen dimensions, Readline's idea of the screen
-size may be queried.
+is still interested in the screen dimensions, it may query Readline's idea
+of the screen size.
 
 @deftypefun void rl_get_screen_size (int *rows, int *cols)
 Return Readline's idea of the terminal's size in the
index 576c35c839d724c4e419cbddd8fe3055ec91b3b4..f9c774ce32dbd8025f72b91d94b4c00061fc8f96 100644 (file)
@@ -1,10 +1,10 @@
 @ignore
-Copyright (C) 1988-2018 Free Software Foundation, Inc. 
+Copyright (C) 1988-2019 Free Software Foundation, Inc. 
 @end ignore
 
 @set EDITION 8.0
 @set VERSION 8.0
-@set UPDATED 30 November 2018
-@set UPDATED-MONTH November 2018
+@set UPDATED 6 March 2019
+@set UPDATED-MONTH March 2019
 
-@set LASTCHANGE Fri Nov 30 22:50:53 EST 2018
+@set LASTCHANGE Wed Mar  6 09:51:02 EST 2019
diff --git a/subst.c b/subst.c
index 4962d2f5884443676f85fce1010b4190063b3d32..45a05f6d3bd2741e3118cd323e267acc17d0c0cb 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -4,7 +4,7 @@
 /* ``Have a little faith, there's magic in the night.  You ain't a
      beauty, but, hey, you're alright.'' */
 
-/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -7055,6 +7055,11 @@ parameter_brace_expand_rhs (name, value, op, quoted, pflags, qdollaratp, hasdoll
      splitting, we want to quote the value we return appropriately, like
      the other expansions this function handles. */
   w->word = (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) ? quote_string (t1) : quote_escapes (t1);
+  /* If we have something that's non-null, that's not a quoted null string,
+     and we're not going to be performing word splitting (we know we're not
+     because the operator is `='), we can forget we saw a quoted null. */
+  if (w->word && w->word[0] && QUOTED_NULL (w->word) == 0)
+    w->flags &= ~W_SAWQUOTEDNULL;
   free (t1);
 
   return w;
@@ -8896,7 +8901,7 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
 
   /* All the cases where an expansion can possibly generate an unbound
      variable error. */
-  if (want_substring || want_patsub || want_casemod || c == '#' || c == '%' || c == RBRACE)
+  if (want_substring || want_patsub || want_casemod || c == '@' || c == '#' || c == '%' || c == RBRACE)
     {
       if (var_is_set == 0 && unbound_vars_is_error && ((name[0] != '@' && name[0] != '*') || name[1]) && all_element_arrayref == 0)
        {
@@ -9317,9 +9322,14 @@ param_expand (string, sindex, quoted, expanded_something,
             identical to $@ */
          if (expand_no_split_dollar_star && quoted == 0 && ifs_is_set == 0 && (pflags & PF_ASSIGNRHS))
            {
-             /* Posix interp 888: RHS of assignment, IFS unset */
-             temp = string_list_dollar_at (list, Q_DOUBLE_QUOTES, pflags);
-             tflag |= W_SPLITSPACE;
+             /* Posix interp 888: RHS of assignment, IFS unset: no splitting,
+                separate with space */
+             temp1 = string_list_dollar_star (list, quoted, pflags);
+             temp = temp1 ? quote_string (temp1) : temp1;
+             /* XXX - tentative - note that we saw a quoted null here */
+             if (temp1 && *temp1 == 0 && QUOTED_NULL (temp))
+               tflag |= W_SAWQUOTEDNULL;
+             FREE (temp1);
            }
          else if (expand_no_split_dollar_star && quoted == 0 && ifs_is_null && (pflags & PF_ASSIGNRHS))
            {
@@ -9333,6 +9343,10 @@ param_expand (string, sindex, quoted, expanded_something,
              /* Posix interp 888: RHS of assignment, IFS set to non-null value */
              temp1 = string_list_dollar_star (list, quoted, pflags);
              temp = temp1 ? quote_string (temp1) : temp1;
+
+             /* XXX - tentative - note that we saw a quoted null here */
+             if (temp1 && *temp1 == 0 && QUOTED_NULL (temp))
+               tflag |= W_SAWQUOTEDNULL;
              FREE (temp1);
            }
          /* XXX - should we check ifs_is_set here as well? */
@@ -10314,7 +10328,7 @@ add_twochars:
             this is when we are going to be performing word splitting,
             since we have to preserve a null argument if the next character
             will cause word splitting. */
-         if (temp == 0 && quoted_state == PARTIALLY_QUOTED && quoted == 0 && (word->flags & W_NOSPLIT) == 0 && (word->flags & W_EXPANDRHS))
+         if (temp == 0 && quoted_state == PARTIALLY_QUOTED && quoted == 0 && (word->flags & (W_NOSPLIT|W_EXPANDRHS|W_ASSIGNRHS)) == W_EXPANDRHS)
            {
              c = CTLNUL;
              sindex--;
@@ -10373,7 +10387,7 @@ add_twochars:
             partially quoted; such nulls are discarded.  See above for the
             exception, which is when the string is going to be split.
             Posix interp 888/1129 */
-         if (temp == 0 && quoted_state == PARTIALLY_QUOTED && quoted == 0 && (word->flags & W_NOSPLIT) == 0 && (word->flags & W_EXPANDRHS))
+         if (temp == 0 && quoted_state == PARTIALLY_QUOTED && quoted == 0 && (word->flags & (W_NOSPLIT|W_EXPANDRHS|W_ASSIGNRHS)) == W_EXPANDRHS)
            {
              c = CTLNUL;
              sindex--;
index 0f713dc3926f37e21d385ed85e13ed9f3e7f79ff..3d8791dd5bb40b9176bf3a4ca95cc3d07fdbe3b4 100755 (executable)
@@ -302,4 +302,8 @@ ${THIS_SH} ./dollar-at7.sub
 # IFS is null
 ${THIS_SH} ./dollar-star9.sub
 
+# more tests for expansions of $* when not splitting with IFS set or unset and
+# null strings as the positional parameters
+${THIS_SH} ./dollar-star10.sub
+
 exit 0
diff --git a/tests/dollar-star10.sub b/tests/dollar-star10.sub
new file mode 100644 (file)
index 0000000..fbd1063
--- /dev/null
@@ -0,0 +1,79 @@
+oIFS=$IFS
+
+set -- ''
+
+unset v
+recho ${v= ''}
+recho $v
+unset v
+recho ${v=''}
+recho $v
+unset v
+recho ${v= $*}
+recho $v
+unset v
+recho ${v=$*}
+recho $v
+unset v
+recho ${v='' }
+recho $v
+unset v
+recho ${v= '' }
+recho $v
+unset v
+recho ${v=$* }
+recho $v
+unset v
+recho ${v= $* }
+recho $v
+
+unset IFS
+
+unset v
+recho ${v= ''}
+recho $v
+unset v
+recho ${v=''}
+recho $v
+unset v
+recho ${v= $*}
+recho $v
+unset v
+recho ${v=$*}
+recho $v
+unset v
+recho ${v='' }
+recho $v
+unset v
+recho ${v= '' }
+recho $v
+unset v
+recho ${v=$* }
+recho $v
+unset v
+recho ${v= $* }
+recho $v
+
+unset -v v
+IFS=$oIFS
+
+# This shouldn't output anything
+set -- '' ''
+
+unset -v v
+recho ${v=$*}
+unset -v v
+recho ${v= $*}
+unset -v v
+recho ${v=$* }
+unset -v v
+recho ${v= $* }
+
+unset -v v IFS
+recho ${v=$*}
+unset -v v
+recho ${v= $*}
+unset -v v
+recho ${v= $* }
+unset -v v
+recho ${v= $*}