Bash-5.2-rc3 available

2022-08-26 Thread Chet Ramey
The third release candidate of bash-5.2 is now available with the URLs

ftp://ftp.cwru.edu/pub/bash/bash-5.2-rc3.tar.gz
https://ftp.gnu.org/pub/gnu/bash/bash-5.2-rc3.tar.gz

and from the bash-5.2-testing branch in the bash git repository
(http://git.savannah.gnu.org/cgit/bash.git/log/?h=bash-5.2-testing).
You can use

git clone --branch bash-5.2-testing git://git.savannah.gnu.org/bash.git

to clone the testing branch.

The CWRU FTP site works best if your client supports Extended Passive
(EPSV) mode.

This tar file includes the formatted documentation (you should be able to
generate updated versions yourself).

This release fixes several outstanding bugs in bash-5.1 and introduces
a number of new features. There are significant new features of note:

* The parser now calls itself recursively to parse command substitutions,
  and reconstitutes the text from the parsed command. This allows better
  syntax checking and catches errors much earlier;

* Bash-5.2 improves associative array subscript parsing with the goal of
  eliminating double evaluation for shell constructs such as arithmetic
  expansion and conditional commands, the `unset' builtin, and arguments
  to other builtin commands as long as assoc_expand_once is set;

* Associative arrays now allow assignment to and unsetting `@' and `*' keys,
  and the `unset' builtin treats `@' and `*' keys differently to allow this;

* There is an alternate array implementation, selectable at configuration
  time, that optimizes access speed over memory use (but can use considerably
  more memory for large sparse arrays);

* There is a configuration option to compile $"..." string translation out of
  the shell, and a runtime shell option to inhibit any additional expansion
  of translated strings;

* The new `varredir_close' shell option causes bash to automatically close
  file descriptors opened with {var}&word) to be printed
   incorrectly (>&word) if no file descriptor was supplied.

2. Changes to Readline

a. Fixed a bug that caused rl_eof_found to be set prematurely while reading a
   multi-character key sequence in callback mode.

3. New Features in Bash

a. In posix mode, the `printf' builtin checks for the `L' length modifier and
   uses long double for floating point conversion specifiers if it's present,
   double otherwise.

b. The `globbing' completion code now takes the `globstar' option into account.

c. `suspend -f' now forces the shell to suspend even if job control is not
   currently enabled.

4. New Features in Readline

--
This document details the changes between this version, bash-5.2-beta, and
the previous version, bash-5.2-alpha.

1. Changes to Bash

a. Fixed a problem with command-oriented history and multi-line commands that
   caused embedded blank lines to be run together.

b. Changed the way `&' is quoted when performing pattern substitution and
   `patsub_replacement' is enabled.

c. Fixed some integer overflows when expanding strings or reading the output
   of command substitution larger than 2GB.

d. `wait -p' without the `-n' option now does something useful if there are no
   jobs.

e. Fixed an issue with read timeouts in posix mode.

f. Changed here-document processing to process $'...' and $"..." only when they
   appear in the WORD portion of ${PARAM OP WORD} in the here-document body
   and the body is being expanded.

g. Changed alias expansion in command substitution to be posix-conformant
   (performed while initially parsing the command substitution) when in posix
   mode.

h. Bash optimizes away more forks in subshells.

i. Here-document construction now performs quote removal on the here-document
   delimiter only if it's marked as quoted, which prevents quote characters in
   command substitutions from being removed.

j. Prompt string expansion now gives invisible characters in the expansion of
   the \w, \W, and \s escape sequences a visible representation to avoid
   problems with redisplay.

k. Fixed a problem with SIGINT during the execution of a command bound with
   `bind -x' affecting the saved terminal settings.

l. Fixed an inconsistency with how $@ expands in a construct like ${@:+set}
   or ${array[@]:+set} in the presence of null positional parameters or
   array elements.

2. Changes to Readline

a. Prevent some display problems when running a command as the result of a
   trap or one bound using `bind -x' and the command generates output.

b. Fixed an issue with multi-line prompt strings that have one or more
   invisible characters at the end of a physical line.

c. Fixed an issue that caused a history line's undo list to be cleared when
   it should not have been.

3. New Features in Bash

a. There is a new bindable readline command name: `vi-edit-and-execute-command'.

4. New Features in Readline

a. Two new bindable string variables: active-region-start-color and
   active-region-end-color. The first sets the color used to d

Re: Bash-5.2-rc3 available

2022-08-26 Thread Kerin Millar
Hi Chet,

On Fri, 26 Aug 2022 14:28:00 -0400
Chet Ramey  wrote:

> 1. Changes to Bash
> 
> a. Added a compatibility mode feature that causes the parser to parse command
>substitutions as if extglob were enabled. If it is enabled before 
> execution,
>parse at execution will succeed. If not, the subsequent execution parse 
> will
>fail.

I harbour some concerns as to both the utility and robustness of this.

$ declare -p BASH_VERSION
declare -- BASH_VERSION="5.2.0(1)-rc3"
$ shopt extglob
extglob off
$ [[ '' = $(shopt extglob >&2) ]]
extglob on
$ shopt extglob
extglob on
$ grep -o extglob <<<"$BASHOPTS" | wc -c
0

For extglob to be arbitrarily enabled in either context is unexpected (and 
undesirable). For BASHOPTS not to be in agreement with the output of shopt is 
also unexpected. I presume that this is as a consequence of the above-mentioned 
change.

Paradoxically, this breaks one of the QA tests implemented by portage. I say 
paradoxically because I'm aware that Gentoo requested a concession pertaining 
to the relationship between the extglob option and the newly recursive parser. 
To put it in perspective, it transpired that only one ebuild (package) in its 
20620-strong repo was affected and that none of the portions of portage that 
are written in bash were affected (until now). My concern is that these 
ostensible concessions to backward-compatibility will end up causing more 
problems than will be solved.

--
Kerin Millar