]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20180809 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 20 Aug 2018 21:02:17 +0000 (17:02 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 20 Aug 2018 21:02:17 +0000 (17:02 -0400)
20 files changed:
CWRU/CWRU.chlog
MANIFEST
array.c
assoc.c
builtins/declare.def
configure
configure.ac
doc/bash.1
doc/bashref.texi
doc/version.texi
lib/readline/doc/rluser.texi
subst.c
tests/array.right
tests/array.tests
tests/array26.sub [new file with mode: 0644]
tests/array6.sub
tests/nameref.right
tests/nameref20.sub
tests/nameref21.sub [new file with mode: 0644]
tests/shopt.right

index 2e3aa5fb1cea1e691d958c57abe9ceab8481b23e..81082497d6f70064f765180d03c58ff3c69308d3 100644 (file)
@@ -4153,3 +4153,36 @@ subst.c
        - expand_string_for_pat: make sure we preserve the value of
          expand_no_split_dollar_star instead of just unconditionally setting
          it back to 0 in case it was 1 before this function was called
+
+                                   8/6
+                                   ---
+array.c
+       - array_modcase: rewrite to work in terms of a WORD_LIST * and call
+         string_list_pos_params on the result to be consistent with the
+         expansions of ${@,,} and ${*,,}
+
+assoc.c
+       - assoc_modcase: rewrite to work in terms of a WORD_LIST * and call
+         string_list_pos_params on the result to be consistent with the
+         expansions of ${@,,} and ${*,,}
+
+subst.c
+       - parameter_brace_casemod: change how return value of {array,assoc}_modcase
+         is treated to make it identical to pos_params_modcase, since they
+         all call string_list_pos_params now
+
+                                   8/8
+                                   ---
+builtins/declare.def
+       - declare_internal: if we are making local variables, and not dealing
+         with the nameref attribute, make sure that any nameref variable we
+         followed when resolving the name given was at the same variable
+         context. If not, we just want to make or use a local variable with
+         the name passed; if so, we want to use the nameref value as the
+         variable name. Report from Grisha Levit <grishalevit@gmail.com>
+
+                                   8/9
+                                   ---
+configure.ac
+       - globasciiranges: RRI now on by default, must be turned off explicitly
+         at configure time or runtime with `shopt -u globasciiranges'
index 6b5ee772ba9ade4ef019202db3284d97cdc80a19..6aec7404a5f7a8cf0707b7a189d1844194378a96 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -869,6 +869,7 @@ tests/array22.sub   f
 tests/array23.sub      f
 tests/array24.sub      f
 tests/array25.sub      f
+tests/array26.sub      f
 tests/array-at-star    f
 tests/array2.right     f
 tests/assoc.tests      f
@@ -1141,6 +1142,7 @@ tests/nameref17.sub       f
 tests/nameref18.sub    f
 tests/nameref19.sub    f
 tests/nameref20.sub    f
+tests/nameref21.sub    f
 tests/nameref.right    f
 tests/new-exp.tests    f
 tests/new-exp1.sub     f
diff --git a/array.c b/array.c
index 56d586b462a05c32e41c5cfc34b762d5ff36955d..bca18c5441a11b7f1e4cc9094b3ae7f2361bbeaf 100644 (file)
--- a/array.c
+++ b/array.c
@@ -481,53 +481,32 @@ char      *pat;
 int    modop;
 int    mflags;
 {
-       ARRAY           *a2;
-       ARRAY_ELEMENT   *e;
-       char    *t, *sifs, *ifs;
-       int     slen;
+       char    *t;
+       int     pchar, qflags;
+       WORD_LIST       *wl, *save;
 
        if (a == 0 || array_head(a) == 0 || array_empty(a))
                return ((char *)NULL);
 
-       a2 = array_copy(a);
-       for (e = element_forw(a2->head); e != a2->head; e = element_forw(e)) {
-               t = sh_modcase(element_value(e), pat, modop);
-               FREE(element_value(e));
-               e->value = t;
+       wl = array_to_word_list(a);
+       if (wl == 0)
+               return ((char *)NULL);
+
+       for (save = wl; wl; wl = wl->next) {
+               t = sh_modcase(wl->word->word, pat, modop);
+               FREE(wl->word->word);
+               wl->word->word = t;
        }
 
-       if (mflags & MATCH_QUOTED)
-               array_quote(a2);
-       else
-               array_quote_escapes(a2);
-
-       if (mflags & MATCH_STARSUB) {
-               array_remove_quoted_nulls (a2);
-               if ((mflags & MATCH_QUOTED) == 0 && ifs_is_null)
-                       sifs = spacesep;
-               else
-                       sifs = ifs_firstchar((int *)NULL);
-               t = array_to_string (a2, sifs, 0);
-               if (sifs != spacesep)
-                       free(sifs);
-       } else if (mflags & MATCH_QUOTED) {
-               /* ${array[@]} */
-               sifs = ifs_firstchar (&slen);
-               ifs = getifs ();
-               if (ifs == 0 || *ifs == 0) {
-                       if (slen < 2)
-                               sifs = xrealloc (sifs, 2);
-                       sifs[0] = ' ';
-                       sifs[1] = '\0';
-               }
-               t = array_to_string (a2, sifs, 0);
-               free(sifs);
-       } else
-               t = array_to_string (a2, " ", 0);
-       array_dispose (a2);
+       pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
+       qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
+
+       t = string_list_pos_params (pchar, save, qflags);
+       dispose_words(save);
 
        return t;
 }
+
 /*
  * Allocate and return a new array element with index INDEX and value
  * VALUE.
diff --git a/assoc.c b/assoc.c
index 202d4a67e136b8b79a194cbb34bf98db765adb8c..673eccb22c11c8c569ce41c31f82621a212edc8d 100644 (file)
--- a/assoc.c
+++ b/assoc.c
@@ -339,54 +339,29 @@ assoc_modcase (h, pat, modop, mflags)
      int modop;
      int mflags;
 {
-  BUCKET_CONTENTS *tlist;
-  int i, slen;
-  HASH_TABLE *h2;
-  char *t, *sifs, *ifs;
+  char *t;
+  int pchar, qflags;
+  WORD_LIST *wl, *save;
 
   if (h == 0 || assoc_empty (h))
     return ((char *)NULL);
 
-  h2 = assoc_copy (h);
-  for (i = 0; i < h2->nbuckets; i++)
-    for (tlist = hash_items (i, h2); tlist; tlist = tlist->next)
-      {
-       t = sh_modcase ((char *)tlist->data, pat, modop);
-       FREE (tlist->data);
-       tlist->data = t;
-      }
-
-  if (mflags & MATCH_QUOTED)
-    assoc_quote (h2);
-  else
-    assoc_quote_escapes (h2);
+  wl = assoc_to_word_list (h);
+  if (wl == 0)
+    return ((char *)NULL);
 
-  if (mflags & MATCH_STARSUB)
-    {
-      assoc_remove_quoted_nulls (h2);
-      sifs = ifs_firstchar ((int *)NULL);
-      t = assoc_to_string (h2, sifs, 0);
-      free (sifs);
-    }
-  else if (mflags & MATCH_QUOTED)
+  for (save = wl; wl; wl = wl->next)
     {
-      /* ${array[@]} */
-      sifs = ifs_firstchar (&slen);
-      ifs = getifs ();
-      if (ifs == 0 || *ifs == 0)
-       {
-         if (slen < 2)
-           sifs = xrealloc (sifs, 2);
-         sifs[0] = ' ';
-         sifs[1] = '\0';
-       }
-      t = assoc_to_string (h2, sifs, 0);
-      free(sifs);
+      t = sh_modcase (wl->word->word, pat, modop);
+      FREE (wl->word->word);
+      wl->word->word = t;
     }
-  else
-    t = assoc_to_string (h2, " ", 0);
 
-  assoc_dispose (h2);
+  pchar = (mflags & MATCH_STARSUB) == MATCH_STARSUB ? '*' : '@';
+  qflags = (mflags & MATCH_QUOTED) == MATCH_QUOTED ? Q_DOUBLE_QUOTES : 0;
+
+  t = string_list_pos_params (pchar, save, qflags);
+  dispose_words (save);
 
   return t;
 }
index 27b30d145da7a76cea56ed74d5f3353729653150..7eac6f5839f0abb52456a8bdddd22de29eabe9ea 100644 (file)
@@ -444,7 +444,20 @@ restart_new_var_name:
 
          /* check name for validity here? */
          var = find_variable (name);
-         newname = (var == 0) ? nameref_transform_name (name, ASS_MKLOCAL) : name;
+         if (var == 0)
+           newname = nameref_transform_name (name, ASS_MKLOCAL);
+         else if ((flags_on & att_nameref) == 0 && (flags_off & att_nameref) == 0)
+           {
+             /* Ok, we're following namerefs here, so let's make sure that if
+                we followed one, it was at the same context (see below for
+                more details). */
+             refvar = find_variable_last_nameref (name, 1);
+             newname = (refvar && refvar->context != variable_context) ? name : var->name;
+             refvar = (SHELL_VAR *)NULL;
+           }
+         else
+           newname = name;     /* dealing with nameref attribute */
+
 #if defined (ARRAY_VARS)
          /* Pass 1 as second argument to make_local_{assoc,array}_variable
             return an existing {array,assoc} variable to be flagged as an
index 73c1ce1ada67082ea3c2552de6b57aa13071776b..682cafecebb730a697042548e7285a509e2153cf 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac for Bash 5.0, version 4.094.
+# From configure.ac for Bash 5.0, version 4.095.
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for bash 5.0-alpha.
 #
@@ -2986,7 +2986,7 @@ opt_casemod_attrs=yes
 opt_casemod_expansions=yes
 opt_extglob_default=no
 opt_dircomplete_expand_default=no
-opt_globascii_default=no
+opt_globascii_default=yes
 opt_function_import=yes
 opt_dev_fd_stat_broken=no
 
@@ -3009,7 +3009,7 @@ if test $opt_minimal_config = yes; then
        opt_net_redirs=no opt_progcomp=no opt_separate_help=no
        opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
        opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
-       opt_globascii_default=no
+       opt_globascii_default=yes
 fi
 
 # Check whether --enable-alias was given.
index 005dddc3972041f2cdcb931bdb8dbe59a7bf6f26..678c18de0c55ead3639175928d6b237389bb66ed 100644 (file)
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
 #   You should have received a copy of the GNU General Public License
 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_REVISION([for Bash 5.0, version 4.094])dnl
+AC_REVISION([for Bash 5.0, version 4.095])dnl
 
 define(bashvers, 5.0)
 define(relstatus, alpha)
@@ -182,7 +182,7 @@ opt_casemod_attrs=yes
 opt_casemod_expansions=yes
 opt_extglob_default=no
 opt_dircomplete_expand_default=no
-opt_globascii_default=no
+opt_globascii_default=yes
 opt_function_import=yes
 opt_dev_fd_stat_broken=no
 
@@ -205,7 +205,7 @@ if test $opt_minimal_config = yes; then
        opt_net_redirs=no opt_progcomp=no opt_separate_help=no
        opt_multibyte=yes opt_cond_regexp=no opt_coproc=no
        opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
-       opt_globascii_default=no
+       opt_globascii_default=yes
 fi
 
 AC_ARG_ENABLE(alias, AC_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
index c3109783f3131c3badbd64d77f953bf309e60926..9d1e5af272c17af827105077106b3c884ca0fca2 100644 (file)
@@ -5,12 +5,12 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Fri Jun  8 16:15:23 EDT 2018
+.\"    Last Change: Tue Aug  7 12:01:07 EDT 2018
 .\"
 .\" bash_builtins, strip all but Built-Ins section
 .if \n(zZ=1 .ig zZ
 .if \n(zY=1 .ig zY
-.TH BASH 1 "2018 June 8" "GNU Bash 5.0"
+.TH BASH 1 "2018 August 7" "GNU Bash 5.0"
 .\"
 .\" There's some problem with having a `@'
 .\" in a tagged paragraph with the BSD man macros.
@@ -2928,6 +2928,14 @@ and
 .SM
 .BR CDPATH ,
 and the shell assigns the expanded value.
+.PP
+Bash also performs tilde expansion on words satisfying the conditions of
+variable assignments (as described above under
+.SM
+.BR PARAMETERS )
+when they appear as arguments to simple commands.
+Bash does not do this, except for the \fIdeclaration\fP commands listed
+above, when in \fIposix mode\fP.
 .SS Parameter Expansion
 .PP
 The `\fB$\fP' character introduces parameter expansion,
@@ -7668,18 +7676,21 @@ them to be reused as input.
 The \fB\-r\fP option removes a completion specification for
 each \fIname\fP, or, if no \fIname\fPs are supplied, all
 completion specifications.
-The \fB\-D\fP option indicates that the remaining options and actions should
+The \fB\-D\fP option indicates that other supplied options and actions should
 apply to the ``default'' command completion; that is, completion attempted
 on a command for which no completion has previously been defined.
-The \fB\-E\fP option indicates that the remaining options and actions should
+The \fB\-E\fP option indicates that other supplied options and actions should
 apply to ``empty'' command completion; that is, completion attempted on a
 blank line.
-The \fB\-I\fP option indicates that the remaining options and actions should
+The \fB\-I\fP option indicates that other supplied options and actions should
 apply to completion on the inital non-assignment word on the line, or after
 a command delimiter such as \fB;\fP or \fB|\fP, which is usually command
 name completion.
 If multiple options are supplied, the \fB\-D\fP option takes precedence
-over \fB\-E\fP, and both take precedence of \fB\-I\fP.
+over \fB\-E\fP, and both take precedence over \fB\-I\fP.
+If any of \fB\-D\fP, \fB\-E\fP, or \fB\-I\fP are supplied, any other
+\fIname\fP arguments are ignored; these completions only apply to the case
+specified by the option.
 .sp 1
 The process of applying these completion specifications when word completion
 is attempted is described above under \fBProgrammable Completion\fP.
@@ -7883,13 +7894,13 @@ If no \fIoption\fPs are given, display the completion options for each
 \fIname\fP or the current completion.
 The possible values of \fIoption\fP are those valid for the \fBcomplete\fP
 builtin described above.
-The \fB\-D\fP option indicates that the remaining options should
+The \fB\-D\fP option indicates that other supplied options should
 apply to the ``default'' command completion; that is, completion attempted
 on a command for which no completion has previously been defined.
-The \fB\-E\fP option indicates that the remaining options should
+The \fB\-E\fP option indicates that other supplied options should
 apply to ``empty'' command completion; that is, completion attempted on a
 blank line.
-The \fB\-I\fP option indicates that the remaining options should
+The \fB\-I\fP option indicates that other supplied options should
 apply to completion on the inital non-assignment word on the line,
 or after a command delimiter such as \fB;\fP or \fB|\fP, which is usually
 command name completion.
index 711cb52334967751c5d6a3b134075cc78201b79f..ba9e2b5157bfa6656d10cdc5c90e2e640f912244 100644 (file)
@@ -1946,6 +1946,12 @@ The string that would be displayed by @samp{dirs +@var{N}}
 The string that would be displayed by @samp{dirs -@var{N}}
 @end table
 
+Bash also performs tilde expansion on words satisfying the conditions of
+variable assignments (@pxref{Shell Parameters})
+when they appear as arguments to simple commands.
+Bash does not do this, except for the @var{declaration} commands listed
+above, when in @sc{posix} mode.
+
 @node Shell Parameter Expansion
 @subsection Shell Parameter Expansion
 @cindex parameter expansion
index 94cc150d18cdbf13569ffdbd3bbc61344df9dd99..7df19724ec3d9a9c0a9b3479d94e80740405ddbc 100644 (file)
@@ -2,10 +2,10 @@
 Copyright (C) 1988-2018 Free Software Foundation, Inc.
 @end ignore
 
-@set LASTCHANGE Fri Jun  8 15:40:43 EDT 2018
+@set LASTCHANGE Tue Aug  7 12:01:22 EDT 2018
 
 @set EDITION 5.0
 @set VERSION 5.0
 
-@set UPDATED 8 June 2018
-@set UPDATED-MONTH June 2018
+@set UPDATED 7 August 2018
+@set UPDATED-MONTH August 2018
index ccdccb0ea2ac32a9fe44476a47b342a9ddb1fc21..1acc8cda9ef717944815c3059ed3221c9659c893 100644 (file)
@@ -2033,18 +2033,21 @@ reused as input.
 The @option{-r} option removes a completion specification for
 each @var{name}, or, if no @var{name}s are supplied, all
 completion specifications.
-The @option{-D} option indicates that the remaining options and actions should
+The @option{-D} option indicates that other supplied options and actions should
 apply to the ``default'' command completion; that is, completion attempted
 on a command for which no completion has previously been defined.
-The @option{-E} option indicates that the remaining options and actions should
+The @option{-E} option indicates that other supplied options and actions should
 apply to ``empty'' command completion; that is, completion attempted on a 
 blank line.
-The @option{-I} option indicates that the remaining options and actions should
+The @option{-I} option indicates that other supplied options and actions should
 apply to completion on the inital non-assignment word on the line, or after a
 command delimiter such as @samp{;} or @samp{|}, which is usually command
 name completion.
 If multiple options are supplied, the @option{-D} option takes precedence
 over @option{-E}, and both take precedence over @option{-I}.
+If any of @option{-D}, @option{-E}, or @option{-I} are supplied, any other
+@var{name} arguments are ignored; these completions only apply to the case
+specified by the option.
 
 The process of applying these completion specifications when word completion
 is attempted is described above (@pxref{Programmable Completion}).
@@ -2241,13 +2244,13 @@ If no @var{option}s are given, display the completion options for each
 @var{name} or the current completion.
 The possible values of @var{option} are those valid for the @code{complete}
 builtin described above.
-The @option{-D} option indicates that the remaining options should
+The @option{-D} option indicates that other supplied options should
 apply to the ``default'' command completion; that is, completion attempted
 on a command for which no completion has previously been defined.
-The @option{-E} option indicates that the remaining options should
+The @option{-E} option indicates that other supplied options should
 apply to ``empty'' command completion; that is, completion attempted on a 
 blank line.
-The @option{-I} option indicates that the remaining options should
+The @option{-I} option indicates that other supplied options should
 apply to completion on the inital non-assignment word on the line, or after a
 command delimiter such as @samp{;} or @samp{|}, which is usually command
 name completion.
diff --git a/subst.c b/subst.c
index c9c94571419c8cdbc8062ae67d2d6227de1c9b06..906b7ac5627c4b67946ea3176d7070a28b9a4751 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -7829,7 +7829,7 @@ pat_subst (string, pat, rep, mflags)
   int rptr, mtype, rxpand, mlen;
   size_t rsize, l, replen, rslen;
 
-  if (string  == 0)
+  if (string == 0)
     return (savestring (""));
 
   mtype = mflags & MATCH_TYPEMASK;
@@ -8309,7 +8309,7 @@ parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, pflags,
        {
          /* Posix interp 888 */
        }
-      else if (temp && (mflags & MATCH_QUOTED)  == 0)
+      else if (temp && (mflags & MATCH_QUOTED) == 0)
        {
          tt = quote_escapes (temp);
          free (temp);
@@ -8327,9 +8327,18 @@ parameter_brace_casemod (varname, value, ind, modspec, patspec, quoted, pflags,
 
       temp = assoc_p (v) ? assoc_modcase (assoc_cell (v), pat, modop, mflags)
                         : array_modcase (array_cell (v), pat, modop, mflags);
-      /* Don't call quote_escapes; array_modcase calls array_quote_escapes
-        as appropriate before adding the space separators; ditto for
-        assoc_modcase. */
+
+      if (temp && quoted == 0 && ifs_is_null)
+       {
+         /* Posix interp 888 */
+       }
+      else if (temp && (mflags & MATCH_QUOTED) == 0)
+       {
+         tt = quote_escapes (temp);
+         free (temp);
+         temp = tt;
+       }
+
       break;
 #endif
     }
index 00e3a9dd93c4eb8ed216efeb8d76d986cbedf8f6..3c465248bac43166d4ae6d03530f06b76789a130 100644 (file)
@@ -270,74 +270,6 @@ argv[1] = <element1 with spaces>
 argv[2] = <element2 with spaces>
 argv[1] = <element1 with spaces>
 argv[2] = <element2 with spaces>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[3] = <aa>
-argv[4] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[3] = <aa>
-argv[4] = <bb>
-argv[1] = <aa+bb>
-argv[2] = <aa+bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[3] = <aa>
-argv[4] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa+bb>
-argv[1] = <xa+bb>
-argv[1] = <xa+bb>
-argv[2] = <xa+bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa+bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xabb>
-argv[1] = <xabb>
-argv[1] = <xabb>
-argv[2] = <xabb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xabb>
 nord!olz
 
 rdholz
@@ -689,3 +621,123 @@ arithmetic:
 6.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="11" )
 7.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="11" )
 8.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="13" )
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <aa+bb>
+argv[2] = <aa+bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa+bb>
+argv[1] = <xa+bb>
+argv[1] = <xa+bb>
+argv[2] = <xa+bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa+bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xabb>
+argv[1] = <xabb>
+argv[1] = <xabb>
+argv[2] = <xabb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xa>
+argv[2] = <bb>
+argv[1] = <xabb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <aa+bb>
+argv[2] = <aa+bb>
+argv[1] = <aa+bb>
+argv[2] = <aa+bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[3] = <aa>
+argv[4] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa>
+argv[2] = <bb>
+argv[1] = <aa+bb>
+argv[1] = <a>
+argv[2] = <b>
+argv[1] = <a>
+argv[2] = <b>
+argv[1] = <a>
+argv[2] = <b>
+argv[3] = <a>
+argv[4] = <b>
+argv[1] = <a+b>
+argv[2] = <a+b>
+argv[1] = <a>
+argv[2] = <b>
+argv[3] = <a>
+argv[4] = <b>
+argv[1] = <a>
+argv[2] = <b>
+argv[1] = <a>
+argv[2] = <b>
+argv[1] = <a>
+argv[2] = <b>
+argv[1] = <a+b>
index e045d5c4aef42d25d9dc7157fa88a6b726339120..7fa1cdaf19324a8704027c51301a7de4194eea86 100644 (file)
@@ -404,3 +404,4 @@ ${THIS_SH} ./array22.sub
 ${THIS_SH} ./array23.sub
 ${THIS_SH} ./array24.sub
 ${THIS_SH} ./array25.sub
+${THIS_SH} ./array26.sub
diff --git a/tests/array26.sub b/tests/array26.sub
new file mode 100644 (file)
index 0000000..826774f
--- /dev/null
@@ -0,0 +1,118 @@
+# these should produce the same results
+a=(aa bb)
+set -- aa bb
+
+IFS=+
+
+recho ${a[@]} 
+recho ${a[@]:0} 
+
+recho $@
+recho ${@:1} 
+
+A=${a[*]} B=${a[*]:0}
+recho $* ${*:1}
+recho ${a[*]} ${a[*]:0}
+recho "$A" "$B"
+recho $A $B
+
+unset A B
+
+recho ${@/a/x} 
+recho ${a[@]/a/x} 
+recho "${@/a/x}"
+recho "${a[@]/a/x}"
+
+recho ${*/a/x} 
+recho ${a[*]/a/x} 
+recho "${*/a/x}"
+recho "${a[*]/a/x}"
+
+A=${*/a/x}
+B=${a[*]/a/x}
+
+recho "$A" "$B"
+
+unset A B
+declare -A A
+A[0]=aa
+A[1]=bb
+
+recho ${A[@]/a/x}
+recho "${A[@]/a/x}"
+recho ${A[*]/a/x}
+recho "${A[*]/a/x}"
+
+unset A
+IFS=
+
+recho ${@/a/x}
+recho ${a[@]/a/x}
+recho "${@/a/x}"
+recho "${a[@]/a/x}"
+
+recho ${*/a/x}
+recho ${a[*]/a/x}
+recho "${*/a/x}"
+recho "${a[*]/a/x}"
+
+A=${*/a/x}
+B=${a[*]/a/x}
+
+recho "$A" "$B"
+
+unset A B
+declare -A A
+A[0]=aa
+A[1]=bb
+
+recho ${A[@]/a/x}  
+recho "${A[@]/a/x}" 
+recho ${A[*]/a/x}   
+recho "${A[*]/a/x}"
+
+unset A
+
+IFS=+
+
+recho ${a[@]}
+recho ${a[@],,} 
+recho "${a[@]}"
+recho "${a[@],,}"
+
+A=${a[*]} B=${a[*],,}
+recho $* ${*,,}
+recho ${a[*]} ${a[*],,}
+recho "${a[*]}" "${a[*],,}"
+recho "$A" "$B"
+recho $A $B
+
+unset A B
+declare -A A
+A[0]=aa
+A[1]=bb
+
+recho ${A[@],,}
+recho "${A[@],,}"
+recho ${A[*],,}
+recho "${A[*],,}"
+
+unset A
+
+recho ${a[@]#?}
+recho ${@#?}
+
+A=${a[*]#?} B=${a[*]#?}
+recho ${*#?} ${a[*]#?}
+recho "$A" "$B"
+recho $A $B
+
+unset A B
+declare -A A
+A[0]=aa
+A[1]=bb
+
+recho ${A[@]#?}  
+recho "${A[@]#?}"   
+recho ${A[*]#?}  
+recho "${A[*]#?}" 
index 2dc40fcb4be3b1c40a9eb440102e3eaf4538ba30..0017f4cd6bf7d7e7805aa8fa36dd5e5f904c1a22 100644 (file)
@@ -113,76 +113,3 @@ recho $@
 
 IFS="$oIFS"
 unset a a2 array foo
-
-# these should produce the same results
-a=(aa bb)
-set -- aa bb
-
-IFS=+
-
-recho ${a[@]} 
-recho ${a[@]:0} 
-
-recho $@
-recho ${@:1} 
-
-A=${a[*]} B=${a[*]:0}
-recho $* ${*:1}
-recho ${a[*]} ${a[*]:0}
-recho "$A" "$B"
-recho $A $B
-
-unset A B
-
-recho ${@/a/x} 
-recho ${a[@]/a/x} 
-recho "${@/a/x}"
-recho "${a[@]/a/x}"
-
-recho ${*/a/x} 
-recho ${a[*]/a/x} 
-recho "${*/a/x}"
-recho "${a[*]/a/x}"
-
-A=${*/a/x}
-B=${a[*]/a/x}
-
-recho "$A" "$B"
-
-unset A B
-declare -A A
-A[0]=aa
-A[1]=bb
-
-recho ${A[@]/a/x}
-recho "${A[@]/a/x}"
-recho ${A[*]/a/x}
-recho "${A[*]/a/x}"
-
-unset A
-IFS=
-
-recho ${@/a/x}
-recho ${a[@]/a/x}
-recho "${@/a/x}"
-recho "${a[@]/a/x}"
-
-recho ${*/a/x}
-recho ${a[*]/a/x}
-recho "${*/a/x}"
-recho "${a[*]/a/x}"
-
-A=${*/a/x}
-B=${a[*]/a/x}
-
-recho "$A" "$B"
-
-unset A B
-declare -A A
-A[0]=aa
-A[1]=bb
-
-recho ${A[@]/a/x}  
-recho "${A[@]/a/x}" 
-recho ${A[*]/a/x}   
-recho "${A[*]/a/x}"
index b52a3e90cc45a1cc868e82eca583d3e45f6d6840..698002ec8ffa016c8fd840c3b11413daaeb97d77 100644 (file)
@@ -469,3 +469,17 @@ ref=Y
 declare -- ref="Y"
 ./nameref20.sub: line 61: declare: var: not found
 ref=Y
+declare -n ref="var"
+declare -A var=([2]="" )
+declare -n ref="var"
+declare -A var=([2]="" )
+declare -n ref="var"
+declare -a var=([2]="")
+declare -n ref="var"
+declare -a var=([2]="")
+declare -n ref="var"
+declare -ai var=([1]="0")
+declare -n ref="var"
+declare -ai var=([1]="0")
+declare -n ref="var"
+declare -- var="1"
index 211975e2e4f5be46b94bbe8aa4c735e8a08978bf..1e6faec9d7c2dd84b5e7becc023b863c9e1b3f13 100644 (file)
@@ -67,3 +67,5 @@ unset -v var
 f
 
 unset -n ref
+unset -f f
+
diff --git a/tests/nameref21.sub b/tests/nameref21.sub
new file mode 100644 (file)
index 0000000..a555a08
--- /dev/null
@@ -0,0 +1,56 @@
+# issues with local variables and local namerefs post-bash-4.4
+
+f()
+{
+       local -n ref=var
+       local -A ref=([1]=)
+#      declare -p ref var
+       ref=([2]=)
+       declare -p ref var
+}
+
+unset ref  var
+f
+
+unset ref; var=0
+f
+
+unset var
+unset -f f
+
+f()
+{      
+       local -n ref=var
+       local -a ref=([1]=)
+       ref=([2]=)
+       declare -p ref var
+}
+
+unset ref var
+f
+
+unset ref; var=0
+f
+
+unset var
+unset -f f
+
+f() { local -n ref=var; local -i ref=([1]=); declare -p ref var; }
+
+unset var
+f
+
+var=0
+f
+
+unset var
+unset -f f
+
+f() { local -n ref=var; local ref=1; declare -p ref var; }
+
+var=0
+f
+
+unset var
+unset -f f
+
index bb0ac6961295a3ab451a4d3a44cef45cf290e11e..64c718c8ddde154110c641d2b745ce3eae313292 100644 (file)
@@ -27,7 +27,7 @@ shopt -u extglob
 shopt -s extquote
 shopt -u failglob
 shopt -s force_fignore
-shopt -u globasciiranges
+shopt -s globasciiranges
 shopt -u globstar
 shopt -u gnu_errfmt
 shopt -u histappend
@@ -63,6 +63,7 @@ shopt -s complete_fullquote
 shopt -s expand_aliases
 shopt -s extquote
 shopt -s force_fignore
+shopt -s globasciiranges
 shopt -s hostcomplete
 shopt -s interactive_comments
 shopt -s progcomp
@@ -89,7 +90,6 @@ shopt -u execfail
 shopt -u extdebug
 shopt -u extglob
 shopt -u failglob
-shopt -u globasciiranges
 shopt -u globstar
 shopt -u gnu_errfmt
 shopt -u histappend
@@ -130,7 +130,6 @@ execfail            off
 extdebug               off
 extglob                off
 failglob               off
-globasciiranges        off
 globstar               off
 gnu_errfmt             off
 histappend             off