On Mon, Oct 06, 2014 at 08:03:13PM +0000, Paul Smith wrote:
> Hi all. I recently found a bug in dash's handling of substring
> processing, when the variable is contained within quotes.
>
> In bash, this works:
>
> bash$ echo $PWD
> /home/psmith
>
> bash$ echo ${PWD%${PWD##*/}}.
> /home/.
>
> bash$ echo "${PWD%${PWD##*/}}."
> /home/.
>
> which is what I expect. However, in dash we get:
>
> dash$ echo $PWD
> /home/psmith
>
> dash$ echo ${PWD%${PWD##*/}}.
> /home/.
>
> dash$ echo "${PWD%${PWD##*/}}."
> .
>
> Whoops! Inside double-quotes dash is mishandling the nested string
> substitution. If I break it up into two steps it works OK, regardless
> of whether or not it's quoted.
>
> This is dash 0.5.7-4ubuntu1 (from Ubuntu GNOME 14.04).
This is already fixed in the current git tree, by the commit:
commit a7c21a6f4cb42d967854cae954efd4ee66bdea9c
Author: Herbert Xu <[email protected]>
Date: Fri Aug 23 20:04:12 2013 +1000
[EXPAND] Propagate EXP_QPAT in subevalvar
So please report this to Ubuntu.
Thanks,
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html