config-patches
[Top][All Lists]
Advanced

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

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


From: Dmitry V. Levin
Subject: Re: [PATCH v2] config.sub: Work around command assignment bug in some shells.
Date: Fri, 20 Aug 2021 17:48:26 +0300

On Sat, Aug 14, 2021 at 12:20:38PM -0400, Nick Bowler wrote:
> When combining variable assignments with a shell command, some older
> shells (notably heirloom-sh and presumably also Solaris 10 /bin/sh)
> have a bug which causes the assignment to alter the current execution
> environment whenever the command is a shell built-in.  For example:
> 
>   % dash -c 'x=good; x=bad echo >/dev/null; echo $x'
>   good
> 
>   % jsh -c 'x=good; x=bad echo >/dev/null; echo $x'
>   bad
> 
> The config.sub script contains a few commands of the form:
> 
>   IFS=- read ...
> 
> which triggers this bug, causing the IFS assignment to persist for the
> remainder of the script.  This can cause misbehaviour in certain cases,
> for example:
> 
>   % jsh config.sub i386-linux-gnu
>   config.sub: test: unknown operator gnu
> 
>   % jsh config.sub i386-gnu/linux
>   sed: can't read s|gnu/linux|gnu|: No such file or directory
>   Invalid configuration `i386-gnu/linux': OS `' not recognized
> 
> * config.sub: Save and restore IFS explicitly to avoid shell bugs.

Applied, thanks.


-- 
ldv



reply via email to

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