round seconds in command timing information if precision is >= 0; fix for readline word boundaries when quoted command substitutions appear; remove nameref attribute when converting nameref variable into an array; change how help strings are written to builtins.c; change read builtin to update unwind-protect if the input string is reallocated; fix crash when an expansion on the rhs of an assignment statement unsets the variable on the lhs

This commit is contained in:
Chet Ramey
2025-10-23 16:35:55 -04:00
parent 6edfd0bf64
commit 403b32faf6
12 changed files with 272 additions and 127 deletions
+13 -3
View File
@@ -203,7 +203,13 @@ make_array_variable_value (SHELL_VAR *entry, arrayind_t ind, const char *key, co
dispose_variable (dentry);
}
else
newval = make_variable_value (entry, value, flags);
{
if (entry)
VSETATTR (entry, att_assigning);
newval = make_variable_value (entry, value, flags);
if (entry)
VUNSETATTR (entry, att_assigning);
}
return newval;
}
@@ -227,7 +233,7 @@ bind_assoc_var_internal (SHELL_VAR *entry, HASH_TABLE *hash, char *key, const ch
(*entry->assign_func) (entry, newval, 0, key);
FREE (key);
}
else
else if (assoc_p (entry))
assoc_insert (hash, key, newval);
FREE (newval);
@@ -251,7 +257,7 @@ bind_array_var_internal (SHELL_VAR *entry, arrayind_t ind, char *key, const char
(*entry->assign_func) (entry, newval, ind, key);
else if (assoc_p (entry))
assoc_insert (assoc_cell (entry), key, newval);
else
else if (array_p (entry))
array_insert (array_cell (entry), ind, newval);
FREE (newval);
@@ -432,7 +438,11 @@ assign_array_element_internal (SHELL_VAR *entry, const char *name, char *vname,
int avflags;
avflags = convert_assign_flags_to_arrayval_flags (flags);
if (entry)
VSETATTR (entry, att_assigning);
ind = array_expand_index (entry, sub, sublen, avflags);
if (entry)
VUNSETATTR (entry, att_assigning);
/* negative subscripts to indexed arrays count back from end */
if (entry && ind < 0)
ind = (array_p (entry) ? array_max_index (array_cell (entry)) : 0) + 1 + ind;