Files
bpfire/src/patches/bash/bash51-004
Adolf Belka f9f6cbd8c6 bash: Update to 5.1 with patch 4
- Update from 5.0 with patch 18 to 5.1 wih patch 4
- Remove old bash50 patches
- Update rootfiles
- Add new bash51 patches
- Installed updated version in a vm testbed system
   All bash commands that were run, executed correctly
   Script created to redirect output to a file and ran correctly
- Changelog
1. New Features in bash-5.1 since release of bash-5.0
a. `bind -x' now supports different bindings for different editing modes and
   keymaps.
b. Bash attempts to optimize the number of times it forks when executing
   commands in subshells and from `bash -c'.
c. Here documents and here strings now use pipes for the expanded document if
   it's smaller than the pipe buffer size, reverting to temporary files if it's
   larger.
d. There are new loadable builtins: mktemp, accept, mkfifo, csv, cut/lcut
e. In posix mode, `trap -p' now displays signals whose disposition is SIG_DFL
   and those that were SIG_IGN when the shell starts.
f. The shell now expands the history number (e.g., in PS1) even if it is not
   currently saving commands to the history list.
g. `read -e' may now be used with arbitrary file descriptors (`read -u N').
h. The `select' builtin now runs traps if its internal call to the read builtin
   is interrupted by a signal.
i. SRANDOM: a new variable that expands to a 32-bit random number that is not
   produced by an LCRNG, and uses getrandom/getentropy, falling back to
   /dev/urandom or arc4random if available. There is a fallback generator if
   none of these are available.
j. shell-transpose-words: a new bindable readline command that uses the same
   definition of word as shell-forward-word, etc.
k. The shell now adds default bindings for shell-forward-word,
   shell-backward-word, shell-transpose-words, and shell-kill-word.
l. Bash now allows ARGV0 appearing in the initial shell environment to set $0.
m. If `unset' is executed without option arguments, bash tries to unset a shell
   function if a name argument cannot be a shell variable name because it's not
   an identifier.
n. The `test -N' operator uses nanosecond timestamp granularity if it's
   available.
o. Bash posix mode now treats assignment statements preceding shell function
   definitions the same as in its default mode, since POSIX has changed and
   no longer requires those assignments to persist after the function returns
   (POSIX interp 654).
p. BASH_REMATCH is no longer readonly.
q. wait: has a new -p VARNAME option, which stores the PID returned by `wait -n'
   or `wait' without arguments.
r. Sorting the results of pathname expansion now uses byte-by-byte comparisons
   if two strings collate equally to impose a total order; the result of a
   POSIX interpretation.
s. Bash now allows SIGINT trap handlers to execute recursively.
t. Bash now saves and restores state around setting and unsetting posix mode,
   instead of having unsetting posix mode set a known state.
u. Process substitution is now available in posix mode.
v. READLINE_MARK: a new variable available while executing commands bound with
   `bind -x', contains the value of the mark.
w. Bash removes SIGCHLD from the set of blocked signals if it's blocked at shell
   startup.
x. `test -v N' can now test whether or not positional parameter N is set.
y. `local' now honors the `-p' option to display all local variables at the
    current context.
z. The `@a' variable transformation now prints attributes for unset array
   variables.
aa. The `@A' variable transformation now prints a declare command that sets a
    variable's attributes if the variable has attributes but is unset.
bb. `declare' and `local' now have a -I option that inherits attributes and
    value from a variable with the same name at a previous scope.
cc. When run from a -c command, `jobs' now reports the status of completed jobs.
dd. New `U', `u', and `L' parameter transformations to convert to uppercase,
    convert first character to uppercase, and convert to lowercase,
    respectively.
ee. PROMPT_COMMAND: can now be an  array variable, each element of which can
    contain a command to be executed like a string PROMPT_COMMAND variable.
ff. `ulimit' has a -R option to report and set the RLIMIT_RTTIME resource.
gg. Associative arrays may be assigned using a list of key-value pairs within
    a compound assignment. Compound assignments where the words are not of
    the form [key]=value are assumed to be key-value assignments. A missing or
    empty key is an error; a missing value is treated as NULL. Assignments may
    not mix the two forms.
hh. New `K' parameter transformation to display associative arrays as key-
    value pairs.
ii. Writing history to syslog now handles messages longer than the syslog max
    length by writing multiple messages with a sequence number.
jj. SECONDS and RANDOM may now be assigned using arithmetic expressions, since
    they are nominally integer variables. LINENO is not an integer variable.
kk. Bash temporarily suppresses the verbose option when running the DEBUG trap
    while running a command from the `fc' builtin.
ll. `wait -n' now accepts a list of job specifications as arguments and will
    wait for the first one in the list to change state.
mm. The associative array implementation can now dynamically increase the
    size of the hash table based on insertion patterns.
nn. HISTFILE is now readonly in a restricted shell.
oo. The bash malloc now returns memory that is 16-byte aligned on 64-bit
    systems.
pp. If the hash builtin is listing hashed filenames portably, don't print
   anything if the table is empty.
qq. GLOBIGNORE now ignores `.' and `..' as a terminal pathname component.
rr. Bash attempts to optimize away forks in the last command in a function body
    under appropriate circumstances.
ss. The globbing code now uses fnmatch(3) to check collation elements (if
    available) even in cases without multibyte characters.
tt. The `fg' and `bg' builtins now return an error in a command substitution
    when asked to restart a job inherited from the parent shell.
uu. The shell now attempts to unlink all FIFOs on exit, whether a consuming
    process has finished with them or not.
vv. There is a new contributed loadable builtin: asort.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-10 13:37:50 +00:00

127 lines
3.7 KiB
Plaintext

BASH PATCH REPORT
=================
Bash-Release: 5.1
Patch-ID: bash51-004
Bug-Reported-by: oguzismailuysal@gmail.com
Bug-Reference-ID: <CAH7i3LoHGmwaghDpCWRUfcY04gQmeDTH3RiG=bf2b=KbU=gyhw@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00039.html
Bug-Description:
If a key-value compound array assignment to an associative array is supplied
as an assignment statement argument to the `declare' command that declares the
array, the assignment doesn't perform the correct word expansions.
This patch makes key-value assignment and subscript assignment perform the
same expansions when they're supplied as an argument to `declare'.
Patch (apply with `patch -p0'):
*** ../bash-5.1-patched/arrayfunc.c 2020-10-09 11:38:58.000000000 -0400
--- arrayfunc.c 2020-12-11 15:12:22.000000000 -0500
***************
*** 598,601 ****
--- 598,622 ----
}
}
+
+ /* Return non-zero if L appears to be a key-value pair associative array
+ compound assignment. */
+ int
+ kvpair_assignment_p (l)
+ WORD_LIST *l;
+ {
+ return (l && (l->word->flags & W_ASSIGNMENT) == 0 && l->word->word[0] != '['); /*]*/
+ }
+
+ char *
+ expand_and_quote_kvpair_word (w)
+ char *w;
+ {
+ char *t, *r;
+
+ t = w ? expand_assignment_string_to_string (w, 0) : 0;
+ r = sh_single_quote (t ? t : "");
+ free (t);
+ return r;
+ }
#endif
***************
*** 641,645 ****
#if ASSOC_KVPAIR_ASSIGNMENT
! if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
{
iflags = flags & ~ASS_APPEND;
--- 662,666 ----
#if ASSOC_KVPAIR_ASSIGNMENT
! if (assoc_p (var) && kvpair_assignment_p (nlist))
{
iflags = flags & ~ASS_APPEND;
*** ../bash-5.1-patched/arrayfunc.h 2020-04-29 17:24:15.000000000 -0400
--- arrayfunc.h 2020-12-11 14:23:50.000000000 -0500
***************
*** 68,71 ****
--- 68,74 ----
extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
+ extern int kvpair_assignment_p PARAMS((WORD_LIST *));
+ extern char *expand_and_quote_kvpair_word PARAMS((char *));
+
extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
extern int skipsubscript PARAMS((const char *, int, int));
*** ../bash-5.1-patched/subst.c 2020-11-16 10:33:15.000000000 -0500
--- subst.c 2020-12-11 15:11:10.000000000 -0500
***************
*** 11605,11608 ****
--- 11605,11609 ----
WORD_LIST *l, *nl;
char *t;
+ int kvpair;
if (flags == 0)
***************
*** 11619,11622 ****
--- 11620,11627 ----
/* Associative array */
l = parse_string_to_word_list (value, 1, "array assign");
+ #if ASSOC_KVPAIR_ASSIGNMENT
+ kvpair = kvpair_assignment_p (l);
+ #endif
+
/* For associative arrays, with their arbitrary subscripts, we have to
expand and quote in one step so we don't have to search for the
***************
*** 11624,11627 ****
--- 11629,11638 ----
for (nl = l; nl; nl = nl->next)
{
+ #if ASSOC_KVPAIR_ASSIGNMENT
+ if (kvpair)
+ /* keys and values undergo the same set of expansions */
+ t = expand_and_quote_kvpair_word (nl->word->word);
+ else
+ #endif
if ((nl->word->flags & W_ASSIGNMENT) == 0)
t = sh_single_quote (nl->word->word ? nl->word->word : "");
*** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */