[Toybox] Endless bash questions...

Chet Ramey chet.ramey at case.edu
Wed Jul 6 07:34:29 PDT 2022


On 7/1/22 4:50 AM, Rob Landley wrote:

> This is complicated by it only being a prefix assignment if the EXPANDED
> arguments provide a nonzero command line:
> 
>   $ abc=def $POTATO
>   $ echo $abc
>   def
> 
> So yeah, there's a sequencing issue. (Bash does variable expansions and
> redirections in two passes, toysh does them in one, so this is a hard hair for
> me to split. But I've got a TODO item for it...)

POSIX specifies multiple operations, though each word in a simple command
is processed only once:

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

And yes, bash does things out of order. It always has, and I'm not changing
it now without an extremely compelling reason.

> P.S. To be honest, the most FRAUGHT part of me asking Chet questions about weird
> corner cases is when he goes "oh, I'll change it". But then it's incompatible
> with previous versions! I dowanna make compatibility with bash a moving target.
> Project's old enough to have defined behavior, whether or not it's RIGHT...

That's not a reasonable decision, for two reasons.

1. It's a sucker's game. You're always going to be `behind' bash, since
   development continues whether you report bugs or not; and

2. It's not great not to report bugs whose fixes might benefit other users.

The best thing to do is to pick a target version whose behavior is fixed --
say, bash-5.1 -- implement compatibility with that, then roll forward if
you want to. Report things that seem wrong or inconsistent, and see if they
change in a future version.

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