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: Tue, 17 Oct 2023 23:55:48 +0200
User-agent: Mutt/2.2.12 (2023-09-09)

> 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.

Before that patch, it was possible to expand a brace expansion in the
subscript of a quoted array parameter expansion if it the brace
expansion was surrounded by double quotes.

    bash-5.1$ letters=( {a..z} ); echo "${letters["{10..15}"]}"
    k l m n o p

    bash-5.3$ letters=( {a..z} ); echo "${letters["{10..15}"]}"
    bash: {10..15}: arithmetic syntax error: operand expected (error token is 
"{10..15}")

o/
 emanuele6



reply via email to

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