On Wed, Mar 19, 2014 at 6:47 PM, Cristian Ionescu-Idbohrn
<[email protected]> wrote:
> On Mon, 17 Mar 2014, Cristian Ionescu-Idbohrn wrote:
>>
>> I just had a look att commit 109ee5d33694a03cda3424b4846584250832ba8e.
>> IMO, to imitate bash behaviour isn't the right thing to do.  It's a bug.

It is also the most widely used shell in Linux.

>> Imitate dash behaviour instead.

Why? Bash user base is much larger than dash, and likely
to remain to be, unless dash developers stop being stubborn
and implement at least, say, command-line editing. Right now,
they seem to enjoy torturing their users. Not a good attitude.

> I can now confirm the commit breaks several scripts based on these
> assumptions:
>
> 1. all script variables are global...
> 2. ...unless declared local
> 3. a `local' declaration inherits the upper scope variable value

About (3): Says who?

> 4. `local' modifications of the variable value are thrown away upon
>    `return' from the function
>
> I consider the bash behaviour buggy.

Considering that sane usage of "local" is to make sure that
locally-used variables don't trash global variables' values,
both behaviors are okay in practice.

> Several distributions (besides debian) adopted, for several reasons,
> dash as the system shell.  Using shell script code from such
> distributions and running it under busybox ash will break.

Did you find a real-world script which does depend on
previous value of "local" variable? Please show it.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to