bug-bash
[Top][All Lists]
Advanced

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

Re: declare a="$b" if $a previously set as array


From: Linda Walsh
Subject: Re: declare a="$b" if $a previously set as array
Date: Mon, 08 Dec 2014 15:29:03 -0800
User-agent: Thunderbird



Eduardo A. Bustamante López wrote:
On Mon, Dec 08, 2014 at 12:48:05PM -0800, Linda Walsh wrote:
--- This usage ***depends*** on delayed evaluation -- which you
claim is "code injection".   This is the way shell is supposed to
operate.  The programmer ***HAS*** to choose when to cause the expression
to be evaluated depending on their need.
If you want delayed evaluation, use 'eval', that's what it's for. Your use case
is a lame excuse for a "feature" that's clearly more evil than useful.

----
        Evil?  You are going to base your argument on religion?
        
        I figured out the problem in your program almost instantly because
I have had to go about deciding to quote or not quote array args and because
I save off arrays between processes so I can re-instantiate them in child
processes (in lieu of exporting).




Also, it's *not* the way it's supposed to operate. Arrays are not POSIX, how
can this be the way it's "supposed" to operate? Where do you get that from?
----
        Of the shells you mention, which implemented arrays first?

Bash was designed to be an extension in features and usability above
/bin/sh -- the standard shell at the time and try to maintain posix
compatibility while providing those extra features.

Using the excuse that other, less advanced shells don't implement things
the same way is a reason for some prefer bash, and others to prefer other
shells.   Trying to dumb down bash to the lowest common feature set of the
less advanced shells you mention seems like going backwards.

        BTW, if you want to compare shells, please don't leave out 'zsh', as
it seems to be the only other shell that has tried to implement advanced features
and not just be another /bin/[k]sh compat-looking posix standard wannabe.

        Instead of dumbing down bash, why not lobby for bash to record
which variables contain tainted input -- and throw an error they are eval'ed
(based on an option setting, of course)?




reply via email to

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