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

Rob Landley rob at landley.net
Tue May 5 10:47:48 PDT 2020


On 5/4/20 1:16 PM, Chet Ramey wrote:
>> Still trying to work out what the "bash spec" would be, vs implementation details...
> 
> I'll be interested when you get that spec done.

I'd love to read it myself. Alas, it's corner cases all the way down:

  $ bash -c $'echo $LINENO\necho $LINENO'
  0
  1
  $ bash <<< 'echo $LINENO'
  1

I'm not currently writing a formal spec, I'm blogging a constant series of
complaints while trying to get the behavior right.

What I usually do with commands is:

A) refer to the relevant existing base spec (if any) at the top
B) document my deviations from that spec (sometimes at length, ala
https://github.com/landley/toybox/blob/master/toys/posix/ps.c)
C) try to have the --help text explain their behavior (which gets long at times,
sed --help is 150 lines)

I currently have no IDEA what "sh --help" should look like when I'm done, and
the base spec I'm referring to is
http://man7.org/linux/man-pages/man1/bash.1.html . The blog entries I mentioned
help me go back and document my deviations from that spec after the fact.

I've occasionally emailed with Elliott about trying to come up with proper
modern descriptions of what unix-ish software actually does and why, but it's a
huge timesink nobody wants to fund, and in the absence of universal basic income
I haven't got the time. :(

Rob

P.S. No posix doesn't try to do this, Microsoft and IBM paid to get NT and
OS/360 posix certified from 1988-1997 so they could be "unixy" enough to win
federal contracts while FIPS-151 was in force. Which means they spent money to
blow enormous holes in Posix, which is why posix doesn't mention the existence
of "mount" or "init". More recently the solaris bigot in chief has done damage
like replacing tar with pax (universally ignored but they'll never admit their
mistake) or removing cpio instead of upgrading it from 6 to 8 bits (hello, it's
the basis for RPM and initramfs in Linux), replacing "cc" with "c99" (why?), yet
dd still specifies ebcdic conversion, sccs is still there, it has uux and uucp
but not ssh/scp/rsync, uncompress but not zip or gzip (IETF documented those as
RFCs)... seriously, I'm waiting for people on that committee to die of old age.

P.P.S. The Linux standard base sort of _tried_ to do this but not well, and then
https://landley.net/notes-2010.html#18-07-2010 happened leading eventually to
https://lwn.net/Articles/658809/ because
http://landley.net/notes-2017.html#24-12-2017 . (Ubuntu was _pissed_ that Red
Hat paid the linux foundation to make RPM the official package management
standard, but the Linux Foundation was happy to cash the check. You can
literally buy a seat on the linux foundation board of directors for $500k/year,
no really: https://landley.net/notes-2020.html#11-02-2020 and yes Microsoft has
done so.)

P.P.P.S. Michael Kerrisk is doing a reasonable job on man7.org, but he's taking
a kitchen sink approach: http://man7.org/linux/man-pages/man1/dh_perl.1.html and
http://man7.org/linux/man-pages/man1/fedabipkgdiff.1.html and
http://man7.org/linux/man-pages/man1/galera_new_cluster.1.html do not belong in
any kind of "base system" specification. Plus there's a "tutorial vs reference"
issue involved here in his chosen format. He's doing a good job, but it's a
_different_ job. Adjacent at best...



More information about the Toybox mailing list