Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-08 Thread Chet Ramey
On 10/6/21 10:47 PM, Koichi Murase wrote: I'd like the default behavior to be closer to what it is when assoc_expand_once is enabled, as I said back in March. I think it's going to be better for users in the long run. Does that mean the behavior with `assoc_expand_once' being disabled also modi

Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-06 Thread Koichi Murase
> I'd like the default behavior to be closer to what it is when > assoc_expand_once is enabled, as I said back in March. I think it's > going to be better for users in the long run. Does that mean the behavior with `assoc_expand_once' being disabled also modified in a way incompatible with older B

Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-06 Thread Chet Ramey
On 10/5/21 10:39 PM, Koichi Murase wrote: >> You're right, there should be no `nesting' considered at all. By the time >> unbind_array_element is called, since it's only called from unset_builtin, >> the word and subscript should have already undergone all the expansion >> they're going to. There

Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-05 Thread Koichi Murase
> The difference is that valid_array_reference can be called before > any of the subscript is expanded, in which case you need to parse > things that can be expanded, where unbind_array_element is called > after all the expansions are performed (but see below). > > So let's see if we can talk throu

Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-05 Thread Chet Ramey
On 10/5/21 7:05 AM, Koichi Murase wrote: > The segmentation fault is fixed by the above patch, but there > still remains the same error as bash 4.4. > > bash-patch1: ${x[0: bad substitution > > This is caused by an inconsistency between `valid_array_reference > (name,flags)' (arrayfu

Re: [PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-05 Thread Koichi Murase
> In Bash 4.0--5.3, the unset command causes the following error: > > bash-4.0: [${x[0]}]: bad array subscript Sorry, please ignore these two lines. This part is unrelated to the fix of the patches. The above error message was produced for the empty associative array key, which is the expect

[PATCH] devel: fix segfault by unset 'assoc[${x[0]}]'

2021-10-05 Thread Koichi Murase
Bash Version: devel branch (441078402919f6f0dd677cad18d55c7a89d294fc), 5.1.8(2)-maint (x86_64-pc-linux-gnu) Description: In the devel branch, « unset 'assoc[${x[0]}]' » causes a segmentation fault, where `assoc' is the name of an associative array. This does not happen with Bash 5.1.