shell parsing bug with &>
Rich Felker
dalias at aerifal.cx
Mon Sep 3 22:22:09 UTC 2012
On Tue, Sep 04, 2012 at 12:12:35AM +0200, Denys Vlasenko wrote:
> On Monday 03 September 2012 18:40, Rich Felker wrote:
> > On Mon, Sep 03, 2012 at 12:58:37PM +0200, Denys Vlasenko wrote:
> > > On Sun, Sep 2, 2012 at 11:21 PM, Rich Felker <dalias at aerifal.cx> wrote:
> > > > It seems busybox ash is misinterpreting "&>" as having some special
> > > > meaning rather than being a "&" token followed by a ">" token. I've
> > > > filed a bug report:
> > > >
> > > > https://bugs.busybox.net/show_bug.cgi?id=5498
> > >
> > > Set CONFIG_ASH_BASH_COMPAT to "no" and it will stop doing that.
> >
> > Indeed I tested and this fixes the problem. But all the other reasons
> > to turn CONFIG_ASH_BASH_COMPAT off just seem to be minimizing binary
> > size;
>
> I see it as a choice between two situations:
>
> 1. "I have my own system where I control all scripts, and can
> make sure they all use only standard shell syntax"
> and
> 2. "I have to support stripts which use bashishm and I can't
> convert them, give me as close to bash behavior as you can".
You left out #3:
"I have to support scripts which assume the shell interpreter conforms
to the standard and which might be using & adjacent to > without an
intervening space."
> Apparently you are in situation #1 (you write your own script
> which clearly can't even be run by bash correctly), so why
> selecting CONFIG_ASH_BASH_COMPAT=n is not a good option for you?
It is a good option; I was just not aware that setting it to "y" would
have effects that break compatibility with standard sh.
> > To resolve this issue, I'd really like to see either the option split
> > out into harmless bash extensions vs incompatible bash extensions,
>
> Wouldn't it be a "maze of zillion configuration opts" disease?
Yes, I tend to agree. I prefer the latter option for the same reason.
> > or just a note added to the documentation in configure that
> > CONFIG_ASH_BASH_COMPAT can break the parsing of conforming scripts
> > (rather than just adding extensions that won't break anything).
>
> Yes, this is acceptable
OK, I think it's the best.
Rich
More information about the busybox
mailing list