No brace expansion for ash?

Chris Rees utisoft at gmail.com
Sun Jul 10 19:02:23 UTC 2011


On 10 July 2011 19:40, Denys Vlasenko <vda.linux at googlemail.com> wrote:
> On Sunday 10 July 2011 19:23, Chris Rees wrote:
>> >> > With ash :
>> >> >
>> >> > # mkdir /tmp/{a,b,c}
>> >> > # ls /tmp
>> >> > {a,b,c}
>> >> >
>> >> >
>> >> > With hush :
>> >> >
>> >> > # mkdir /tmp/{a,b,c}
>> >> > # ls /tmp
>> >> > a  b  c
>> >> >
>> >> >
>> >> > Brace expansion works in hush but not in ash.
>> >>
>> >> It shouldn't work in ash, as Denys said. It's a bashism.
>> >
>> > I didn't say it should not, I said it doesn't work.
>> >
>> > IOW: there is no policy decision to never ever implement
>> > brace expansion in ash, it's just not implemented right now.
>> >
>>
>> So... do we need a separate ash and hush if ash doesn't need to be
>> sh-compatible? I don't want to start a flamewar, but I think that
>> portability is very important, and adding strange extensions means
>> that people use code that breaks on other platforms, as you well know
>> from the latest patches to gen_build.sh.
>
> Bash is a standard Linux shell. Therefore bash compatibility hardly
> can be qualified as "strange". You may not like it, but bash was
> providing this functionality on Linux for years.
>
> Bash compatibility in both ash and hush is optional, therefore
> you are free to configure them to not have these "strange extensions".
>
> However, you are not free to dictate other people that they must not
> use these extensions. Because when you start telling other people
> what they should do is where freedom ends and control freakism starts.

I'm certainly not advocating telling people what to do, although I can
see how that's coming across.

Of course it's up to the Busybox project to set your own policy -- my
problem with adding non-standard features to shells is that people
rely on them and write incompatible scripts when *all that is needed*
is to just use the correct language in the first place.

I don't think it's too much of a straw man to compare this with
expecting C to support foreach, or expecting the 'dir' command to work
(like RH7 did...).

However, I can see that this avenue of reason is not going to change
any minds, so I'm going to apologise for jumping on Eric like that and
advising against the patch -- it wasn't really my place to say that
and I accept that.

Can I make a final plea, if this is implemented as an option, can it
please be disabled by default? This should make people more aware that
it's a nonstandard function -- bash may be the standard shell on GNU
systems, but it's not in most other OSes.

Chris


More information about the busybox mailing list