bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash tries to parse comsub in quoted PE pattern


From: Emanuele Torre
Subject: Re: bash tries to parse comsub in quoted PE pattern
Date: Wed, 18 Oct 2023 16:24:19 +0200
User-agent: Mutt/2.2.12 (2023-09-09)

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 <torreemanuele6@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]