On Wed, Oct 18, 2023 at 09:50:00AM -0400, Chet Ramey wrote: > On 10/17/23 5:55 PM, Emanuele Torre wrote: > > > braces.c > > > - brace_gobbler: use extract_dollar_brace_string if we see ${ with > > > the appropriate value of QUOTING, so we don't have to teach brace > > > expansion more shell syntax. > > > Report from Emanuele Torre <torreemanue...@gmail.com> > > > - brace_gobbler: call the word extraction functions with SX_NOALLOC > > > so we don't have to allocate memory we're just going to free > > > > That patch fixed the bug with "${foo#'$('}", but it also broke the > > "${arr["{start..end}"]}" / "${arr["{foo,bar}"]}" patterns. > > How much shell syntax do you want? You want brace expansion to detect > some issues with parameter expansion but ignore others, and detect > some expansions but not others, without supplying requirements.
I didn't even think that the "${foo#'$('}" had something to do with brace expansion. I only noticed that "${foo#'$('}" started being a syntax error on evaluation in bash 4.3 (apparently only when brace expansion is enabled), and I thought that was not correct, so I reported it. Now I am reporting that the patch that was supposed to fix that problem made "${foo["{2,1}"]}" no longer expands to "${foo["2"]}" "${foo["1"]}". Brace expansion between "${foo[" and "]}" is something that has always worked: at least since bash 2.05b (I have not checked with earlier versions after the introduction of arrays). Is it really ok to break that behaviour? o/ emanuele6