config-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] config.sub: Work around command assignment bug in some shell


From: Nick Bowler
Subject: Re: [PATCH] config.sub: Work around command assignment bug in some shells.
Date: Sat, 14 Aug 2021 03:14:58 -0400

On 13/08/2021, Karl Berry <karl@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

[Prev in Thread] Current Thread [Next in Thread]