[PATCH] gen_build_files.sh: rewrite with sed
Denys Vlasenko
vda.linux at googlemail.com
Sun Nov 21 21:22:18 UTC 2010
On Thursday 18 November 2010 10:38, Mike Frysinger wrote:
> > > > > + local src="$1" dst="$2" header="$3" insert="$4"
> > > >
> > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > >
> > > > All of it or parts of it may go wrong if the default shell is dash
> > >
> > > wrong. the code works fine.
> >
> > AFAIK, The only place where the simultaneous define and assignment
> > breaks down is where the assignment is like:
> > local foo=$(bar baz) || err_handler
> > In that case, the 'local' keyword will always return true, causing the
> > err_handler routine to not be executed if bar fails.
> > For simple assignment, there is no issue at all. In fact, the code above
> > is the most efficient.
>
> yes, that is problematic for the reason you describe, but not applicable here.
> dash is also a pos and requires the quoting where sane shells like bash work
> fine with: local f=$(echo a b)
This is actually a gigantic PITA to implement properly in shell.
The *parser* should understand that "local" isn't merely
a word which happen to be the name of a builtin, but it magically
changes the rules how the following args are parsed.
This is broken because *parser* should not know what "local" is.
Only *execution engine* should.
Of course parser can be hacked to special-case word "local".
However, how about this?
"local" f=$(echo a b)
It is still possible to parse this specially (but bash does not).
But how about this????
l=local
f() { $l v=$(echo a b); .... }
--
vda
More information about the busybox
mailing list