]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20181210 snapshot
authorChet Ramey <chet.ramey@case.edu>
Fri, 14 Dec 2018 14:19:57 +0000 (09:19 -0500)
committerChet Ramey <chet.ramey@case.edu>
Fri, 14 Dec 2018 14:19:57 +0000 (09:19 -0500)
CWRU/CWRU.chlog
po/zh_CN.po
variables.c

index 855e7e0ea3a9730de41518a4c3b9d27733c03bf1..7361e05db4ef8472050804c5231246a92cc646d2 100644 (file)
@@ -4868,3 +4868,10 @@ parse.y
        - select_command: add two additional productions to support select
          commands without a word_list following the `in'. Fixes omission
          reported by Martijn Dekker <martijn@inlv.org>
+
+                                  12/11
+                                  -----
+variables.c
+       - assign_in_env: don't allow namerefs in temporary environment
+         assignments to create variables with invalid names for export. Fixes
+         bug reported by Grisha Levit <grishalevit@gmail.com>
index 4c69976e57678b8ec2a0967c54e2e0c291a96124..104415bf7bf33c8e4fe27802aab0d416154d84e1 100644 (file)
@@ -40,7 +40,7 @@ msgstr ""
 "Project-Id-Version: bash 5.0-beta2\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2018-11-16 15:54-0500\n"
-"PO-Revision-Date: 2018-12-08 14:10-0500\n"
+"PO-Revision-Date: 2018-12-13 13:27-0500\n"
 "Last-Translator: Boyuan Yang <073plan@gmail.com>\n"
 "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
 "Language: zh_CN\n"
@@ -2536,9 +2536,9 @@ msgstr ""
 "从别名定义列表中删除每一个“名字”。\n"
 "    \n"
 "    选项:\n"
-"      -a\t删除所有的别名定义\n"
+"      -a\t删除所有的别名定义\n"
 "    \n"
-"    è¿\94å\9b\9eæ\88\90å\8a\9fï¼\8cé\99¤é\9d\9eâ\80\9cå\90\8då­\97â\80\9c不是一个已存在的别名。"
+"    è¿\94å\9b\9eæ\88\90å\8a\9fï¼\8cé\99¤é\9d\9eâ\80\9cå\90\8då­\97â\80\9d不是一个已存在的别名。"
 
 #: builtins.c:291
 msgid ""
index 638d6ecd4111d643ae99fb5e8f609e6d7593e5b8..60e62267af05a91e33f41d2eb6081cab1e79f78a 100644 (file)
@@ -169,6 +169,7 @@ SHELL_VAR nameref_invalid_value;
 static SHELL_VAR nameref_maxloop_value;
 
 static HASH_TABLE *last_table_searched;        /* hash_lookup sets this */
+static VAR_CONTEXT *last_context_searched;
 
 /* Some forward declarations. */
 static void create_variable_tables __P((void));
@@ -2607,6 +2608,17 @@ make_local_variable (name, flags)
   if (was_tmpvar && old_var->context == variable_context && last_table_searched != temporary_env)
     {
       VUNSETATTR (old_var, att_invisible);     /* XXX */
+#if 0  /* TAG:bash-5.1 */
+      /* We still want to flag this variable as local, though, and set things
+         up so that it gets treated as a local variable. */
+      new_var = old_var;
+      /* Since we found the variable in a temporary environment, this will
+        succeed. */
+      for (vc = shell_variables; vc; vc = vc->down)
+       if (vc_isfuncenv (vc) && vc->scope == variable_context)
+         break;
+      goto set_local_var_flags;
+#endif
       return (old_var);
     }
 
@@ -2694,6 +2706,7 @@ make_local_variable (name, flags)
        new_var->attributes = exported_p (old_var) ? att_exported : 0;
     }
 
+set_local_var_flags:
   vc->flags |= VC_HASLOCAL;
 
   new_var->context = variable_context;
@@ -3213,6 +3226,9 @@ bind_variable (name, value, flags)
          nvc = vc;
          if (v && nameref_p (v))
            {
+             /* This starts at the context where we found the nameref. If we
+                want to start the name resolution over again at the original
+                context, this is where we need to change it */
              nv = find_variable_nameref_context (v, vc, &nvc);
              if (nv == 0)
                {
@@ -3234,8 +3250,9 @@ bind_variable (name, value, flags)
                  else if (nv == &nameref_maxloop_value)
                    {
                      internal_warning (_("%s: circular name reference"), v->name);
-#if 0
-                     return (bind_variable_value (v, value, flags|ASS_NAMEREF));
+#if 1
+                     /* TAG:bash-5.1 */
+                     return (bind_global_variable (v->name, value, flags));
 #else
                      v = 0;    /* backwards compat */
 #endif
@@ -3246,8 +3263,9 @@ bind_variable (name, value, flags)
              else if (nv == &nameref_maxloop_value)
                {
                  internal_warning (_("%s: circular name reference"), v->name);
-#if 0
-                 return (bind_variable_value (v, value, flags|ASS_NAMEREF));
+#if 1
+                 /* TAG:bash-5.1 */
+                 return (bind_global_variable (v->name, value, flags));
 #else
                  v = 0;        /* backwards compat */
 #endif
@@ -3557,7 +3575,10 @@ assign_in_env (word, flags)
             but the variable does not already exist, assign to the nameref
             target and add the target to the temporary environment.  This is
             what ksh93 does */
-         if (var && nameref_p (var) && valid_nameref_value (nameref_cell (var), 1))
+         /* We use 2 in the call to valid_nameref_value because we don't want
+            to allow array references here at all (newname will be used to
+            create a variable directly below) */
+         if (var && nameref_p (var) && valid_nameref_value (nameref_cell (var), 2))
            {
              newname = nameref_cell (var);
              var = 0;          /* don't use it for append */