On 13/08/2021, Karl Berry <k...@freefriends.org> wrote:
>     When combining variable assignments with a shell command, some older
>     shells (notably heirloom-sh and presumably also Solaris 10 /bin/sh)
>
> Just to confirm: Solaris 10 /bin/sh does indeed also have this bug.
>
> sparcsol$ /bin/sh -c 'x=good; x=bad :; echo $x'
> bad
> $ uname -a
> SunOS sparcsol 5.10 Generic_150400-48 sun4v sparc SUNW,T5240
>
> Debian 11 dash apparently does also, which seems surprising to me.

This is my error, it is an incorrect demonstration of the problem
because : is actually not a regular built-in, but rather it is a
special built-in.  POSIX specifies the dash behaviour, but not all
shells implement this rule for special built-ins (e.g., bash does
not unless run in POSIX compatibility mode).

A better example using a regular built-in instead:

  % dash -c 'x=good; x=bad echo; echo $x'
  [blank line]
  good

  % jsh -c 'x=good; x=bad echo; echo $x'
  [blank line]
  bad

I can spin a v2 patch with a new log message.

Cheers,
  Nick

Reply via email to