bug-bash
[Top][All Lists]
Advanced

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

Re: zsh style associative array assignment bug


From: Greg Wooledge
Subject: Re: zsh style associative array assignment bug
Date: Wed, 31 Mar 2021 07:38:33 -0400

On Wed, Mar 31, 2021 at 09:40:34AM +0200, felix wrote:
> As bash read loop could be something slow, I use (when I'm quiet about data
> origin) something like:
> 
>   declare -A tags="($(
>       sed -e 's/^\([^|]*\)|\?\(.*\)/[\1]="\2"/' < <(
>          exiftool ...)) )"

>   I'm not absolutely sure about border effect and security issues.

I'm absolutely sure that it's terribly unsafe.  If there are any double
quotes or (command) substitutions in the tag values, this breaks quite
hard.

I'm also confused about what the \? is supposed to be doing, and whether
you're using some kind of crazy GNUism there.  It looks like one to me.
Please remember that sed is supposed to use BRE, and the equivalent of
ERE's ? operator in BRE is \{0,1\} .



reply via email to

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