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

Chet Ramey chet.ramey at case.edu
Tue Mar 10 08:24:46 PDT 2020


On 3/9/20 4:10 PM, Rob Landley wrote:
> On 3/8/20 2:57 PM, Chet Ramey wrote:
>> Remember the brouhaha (this was at least 15 years ago) about the standard
>> saying that `set -e' only applied to simple commands and bash having the
>> audacity to implement what the standard said? Good times.
> 
> Bit too inside baseball for me. Computer history is a hobby of mine, ala
> https:;//landley.net/history/mirror, but my dreams of writing a book on the
> subject got kinda back-burnered years ago because my todo list runneth over.

There's not too much more to it than that. It took years, and lots of
discussion, but we finally got `set -e' cleaned up in 2009. Plenty of
"the standard says this, but that wasn't what it meant!" before that, though.


>>> The bash man page defines "IFS whitespace" as different from unicode whitespace.
>>> (Space, tab, and newline only. Mine will in theory take the non-blank oggham
>>> whitespace, although I haven't added that to tests/sh.test yet. :)
>>
>> Bash will, too. If you want to put a non-breaking space into $IFS, it will
>> be happy to split words on it. The business about "IFS whitespace" being
>> space/tab/newline is to reconcile differences between historical behaviors
>> that date back to an ASCII-only world. You have to live with those.
> 
> Mine is collating the other (nonbreakable) whitespaces. Haven't checked what
> bash is doing, just noted that the man page makes a gratuitous distinction there.

You can see it in all its glory in

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05


>> How do you reconcile the differences when bash and dash (as /bin/sh) do
>> different things? Dash is most definitely a posix-and-little-else shell.
> 
> Ah, the Defective Annoying SHell. I have OPINIONS there.

Yes, apparently.

> 
>   https://landley.net/notes-2010.html#28-10-2010
> 
> I've been railing against that since it went in.
> 
> In 1991 Linus Torvalds created Linux by extending a terminal program he'd
> written to run Bash.

Yep, I was there for this. I had been working on bash for three years or
so by that time. I probably have some messages we exchanged somewhere.


> And had the "tanenbaum-torvalds debate":
> 
>   https://www.oreilly.com/openbook/opensources/book/appa.html

I remember that fondly, especially Tanenbaum's firm declaration that
"Microkernels have won."


> So they changed the #!/bin/sh symlink to point to a shell that that broke the
> kernel build, got tty handling wrong (fork a background task with &, ctrl-c
> killed it), and so on. It was a HORRIBLE MISTAKE, and worst of all it didn't fix
> the problem that had caused them to do it in the first place, their init scripts
> STILL ran too slowly, so they had to parallelize the build system by creating
> "upstart" shortly afterwards.

Not being a Debian/Ubuntu guy, I never saw this part of it. Dash is pretty
solid now, though.

Dash is a still bit faster than bash, and bash is much faster than it was
15 years ago. Jorg Schilling (yeah, I know) is not shy about claiming that
if dash were to start supporting multibyte characters, its performance
advantage would disappear quickly.


> No, I don't care what dash does. It can go hang.

Herbert's insistence on strict POSIX conformance makes it a decent shell to
test behavior differences against.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/



More information about the Toybox mailing list