https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283934

--- Comment #3 from Jamie Gritton <[email protected]> ---
The reason ",$x" and "$x," work and "$x" doesn't is that inline substitution of
an array value is illegal, but variable assignment from an array value is fine.

As it turns out, even though "$x" looks like inline substitution, it is in fact
a simple assignment: '$y = "$x"' is exactly the same as '$y - $x'.  The reason
for this is the quote marks are just used to make the parser accept what would
normally be multiple tokens as a single token (that later can get variable
substitution).  The quote marks are long gone by the time substitution happens.

So what makes a substitution inline or not?  It's inline if there's anything in
the target variable's value besides the the source variable.  The value "$x"
has nothing before besides $x itself so it's no an inline substitution but an
assignment, and thus can take an array value.

Apparently, people don't try to assign parameters (or variables) to
multi-valued variables, because that's the code that crashes.  I re-used a
variable in that bit of code, which is what the patch fixes.  My fault for
using variable names like "s".

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to