Segfault assigning to nameref with bad array subscript

2016-04-26 Thread Grisha Levit
Any of the following will crash bash: declare -n ref=a[*]; ref= declare -n ref=a[@]; ref= declare -n ref=a[-1]; a=(); ref= declare -A A; declare -n ref='A[$unset]'; ref= They all produce "bad array subscript" errors so could be caught. ==60597== Invalid read of size 4 ==60597==at 0x100020BE

Re: bash 4.4 and BASHOPTS containing extdebug in env

2016-04-26 Thread Grisha Levit
Thanks for the explanation. I'd read that thread but thought the change was supposed to only modify the behavior when explicitly specifying the --debugger option. That also seems to be the gist of the original RedHat bugzilla request that prompted the thread: https://bugzilla.redhat.com/show_bug.

Re: bash 4.4 and BASHOPTS containing extdebug in env

2016-04-26 Thread Chet Ramey
On 4/25/16 10:45 PM, Grisha Levit wrote: > This seems new for 4.4. Having extdebug in BASHOPTS seems to change the > invocation behavior to mimic that of having specified the --debugger > option, which I don't think is usually the intention: It's always been the case. The --debugger option and -

Re: Autocompletion problems with nounset and arrays

2016-04-26 Thread Eric Pruitt
On Tue, Apr 26, 2016 at 01:54:12PM -0400, Chet Ramey wrote: > Thanks for the report. I will fix this before bash-4.4 is released. Thank you. I am happy to compile a prerelease build to try out your solution if you want another tester before you roll fix into an RC. Eric

Re: "${x-"$@"}" expansion

2016-04-26 Thread Grisha Levit
The same is true for + expansion: Multiple words: $ set -- 1 2; v=( "${#+$@}" ); declare -p v declare -a v=([0]="1" [1]="2") Empty string: $ set --; v=( "${#+$@}" ); declare -p v declare -a v=([0]="") Nothing: $ set --; v=( "${#+${#+$@}}" ); declare -p v declare -a v=()

"${x-"$@"}" expansion

2016-04-26 Thread Grisha Levit
This behavior seems very strange. This example is with $@ but it seems the same for ${array[@]} The manual says for ${parameter:-word}: > If parameter is unset or null, the expansion of word is substituted. In this case, $@ is expanded as if it was quoted (even if 'word' is not quoted) and the

web page has a misspelling (typo) "discus" should be "discuss"

2016-04-26 Thread Paul Fardy
>From https://www.gnu.org/software/bash/ > Mailing lists > > To ask for help about bash, bash programming or bash shell scripting please > use the mailing list. To report bugs or to DISCUS most > aspects of developing bash please use the mailing list.

Re: Autocompletion problems with nounset and arrays

2016-04-26 Thread Chet Ramey
On 4/26/16 1:09 AM, Eric Pruitt wrote: > Bash Version: 4.3 > Patch Level: 30 > Release Status: release > > Description: > There's a quirk with Bash's autocompletion when trying to use tab > completion with built-in arrays while the nounset option is enabled: > > ~$ echo ${BASH_

Autocompletion problems with nounset and arrays

2016-04-26 Thread Eric Pruitt
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKA