Bash-5.3-beta release

This commit is contained in:
Chet Ramey
2024-12-17 09:51:38 -05:00
parent aadb6ffb93
commit f223b24c4b
319 changed files with 57094 additions and 42486 deletions
+7 -8
View File
@@ -276,7 +276,7 @@ bind_array_variable (const char *name, arrayind_t ind, const char *value, int fl
}
if (entry == (SHELL_VAR *) 0)
entry = make_new_array_variable (name);
else if ((readonly_p (entry) && (flags&ASS_FORCE) == 0) || noassign_p (entry))
else if (ASSIGN_DISALLOWED (entry, flags))
{
if (readonly_p (entry))
err_readonly (name);
@@ -298,7 +298,7 @@ bind_array_element (SHELL_VAR *entry, arrayind_t ind, char *value, int flags)
SHELL_VAR *
bind_assoc_variable (SHELL_VAR *entry, const char *name, char *key, const char *value, int flags)
{
if ((readonly_p (entry) && (flags&ASS_FORCE) == 0) || noassign_p (entry))
if (ASSIGN_DISALLOWED (entry, flags))
{
if (readonly_p (entry))
err_readonly (name);
@@ -406,6 +406,9 @@ assign_array_element_internal (SHELL_VAR *entry, const char *name, char *vname,
if (estatep)
nkey = savestring (akey); /* assoc_insert/assoc_replace frees akey */
entry = bind_assoc_variable (entry, vname, akey, value, flags);
/* If we didn't perform the assignment, free the key we allocated */
if (entry == 0 || (ASSIGN_DISALLOWED (entry, flags)))
FREE (akey);
if (estatep)
{
estatep->type = ARRAY_ASSOC;
@@ -476,7 +479,7 @@ find_or_make_array_variable (const char *name, int flags)
if (var == 0)
var = (flags & 2) ? make_new_assoc_variable (name) : make_new_array_variable (name);
else if ((flags & 1) && (readonly_p (var) || noassign_p (var)))
else if ((flags & 1) && ASSIGN_DISALLOWED(var, 0))
{
if (readonly_p (var))
err_readonly (name);
@@ -1359,8 +1362,7 @@ array_expand_index (SHELL_VAR *var, const char *s, int len, int flags)
exp = (char *)xmalloc (len);
strncpy (exp, s, len - 1);
exp[len - 1] = '\0';
#if 1 /* TAG: bash-5.3 */
#if 0
#if 0 /* XXX - not dependent on compatibility mode for now */
if (shell_compatibility_level <= 52 || (flags & AV_NOEXPAND) == 0)
#else
if ((flags & AV_NOEXPAND) == 0)
@@ -1368,9 +1370,6 @@ array_expand_index (SHELL_VAR *var, const char *s, int len, int flags)
t = expand_arith_string (exp, Q_DOUBLE_QUOTES|Q_ARITH|Q_ARRAYSUB); /* XXX - Q_ARRAYSUB for future use */
else
t = exp;
#else
t = expand_arith_string (exp, Q_DOUBLE_QUOTES|Q_ARITH|Q_ARRAYSUB); /* XXX - Q_ARRAYSUB for future use */
#endif
savecmd = this_command_name;
this_command_name = (char *)NULL;
eflag = (shell_compatibility_level > 51) ? 0 : EXP_EXPANDED;