[Toybox] Would someone please explain what bash is doing here?
Chet Ramey
chet.ramey at case.edu
Wed May 6 12:32:33 PDT 2020
On 5/6/20 2:08 PM, Rob Landley wrote:
>> You're blogging these bash corner cases, too?
>
> I was. I was recently asked to stop.
Who asked you to stop?
> If you change them, that makes bash a moving target.
Bash is evolving, not dead. There is room for bug fixes and improvements
everywhere. I'm not going to stop fixing things, even if they've been there
for a long time, if I think the behavior is wrong. Conversely, if I don't
think the behavior is wrong, backwards compatibility is an important
consideration.
> I'd use the man page as the spec, but when the man page documents $_ it says
> "absolute path":
>
> _ At shell startup, set to the absolute pathname used to invoke
> the shell or shell script being executed as passed in the envi‐
> ronment or argument list.
>
> And that's not what bash does:
>
> $ ln -s $(which bash) .
> $ ./bash -c 'echo $_'
> ./bash
Sure. Probably another corner case to change; the documentation this time.
> (P.S. If you think I'm being meticulous, you should see what the actual security
> professionals I used to follow on twitter do to this stuff: @aloria and
> @hacks4pancakes and @fox0x01 and @0xabad1dea and @malwareunicorn and @evacide
> and so on.
Yep, I read them too when they come into my feed, and sometimes when they
don't.
>>> I currently have no IDEA what "sh --help" should look like when I'm done,
>>
>> I'm pretty sure bash --help complies with whatever GNU coding standards
>> cover that option.
>
> Currently 2/3 of bash --help lists the longopts, one per line, without saying
> what they do. So yeah, that sounds like the GNU coding standards.
Hey, it's supposed to be brief. I did consider how to handle the long
options, since it's easy to do the one-letter options, and decided there
wasn't really a better way to do it.
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