[Toybox] Would someone please explain what bash is doing here?

Rob Landley rob at landley.net
Fri Mar 13 09:25:39 PDT 2020



On 3/13/20 8:12 AM, Chet Ramey wrote:
> On 3/12/20 7:08 PM, Rob Landley wrote:
> 
>>>> Minimalism and POSIX conformance are the big selling points now, at least
>>>> on the shell side of things.
>>
>> I dunno about minimalism, but I'm trying to get toys/pending/sh.c in under 3500
>> lines. (It's 2400 now, maybe 100 of which is debug code. So it's still feasible,
>> but tight. And yeah, that's pulling in some subset of lib/*.c's 5600 lines, so
>> maybe 9k lines total. Plus my original plan for command history editing went out
>> the window, so I have to redo that...)
>>
>> Then again, I'm trying to implement more functionality in that budget than dash
>> is. Does that make it less minimalist?
> 
> The dash folks would say so.

Uh-huh. So it's a _choice_ that "dash /usr/bin" exits with 0, as does
dash -c 'echo hello;}' (14 years after ubuntu's /bin/sh)?

I keep finding some weird bug of the "how could bash NOT have noticed this was
wrong" variety,and then I realize I'm comparing "./sh" vs "sh" again and it's
only a dash problem, bash is fine. (All the other commands I've done, host and
new command had the same name so that kind of smoketest was fine. Muscle memory
costs me an hour each time.)

I repeat, dash can go hang. Implementation quality aside, I disagree with their
objectives and design goals. The only reason I haven't pointed #!/bin/sh at bash
like everyone else I know is I don't want any of my scripts accidentally
starting with #!/bin/sh to _ship_, I want them to break locally so I notice I
did the #! line wrong.

Rob



More information about the Toybox mailing list