bug-bash
[Top][All Lists]
Advanced

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

Re: coproc and existing variables


From: Chet Ramey
Subject: Re: coproc and existing variables
Date: Sun, 24 Apr 2016 14:17:46 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 4/21/16 2:39 PM, Grisha Levit wrote:
> On Thu, Apr 21, 2016 at 1:22 PM, Chet Ramey <chet.ramey@case.edu> wrote:
>>
>>> 1. coproc unsets readonly NAME after the process completes
>>
>> Yes.  This is a gray area.  Under some circumstances, e.g, getopts with
>> OPTARG, defined shell behavior can override a readonly setting.
> 
> Probably should at least disallow this case?
> 
> $ bash -r -c 'coproc PATH { :; }; wait; PATH=/whatever; echo $PATH'
> bash: PATH: readonly variable
> bash: PATH: readonly variable
> /whatever

Yes, even though the restricted shell is not a great example of anything,
it seems reasonable to follow printf/read/mapfile and not overwrite read-
only variables used as coproc names.  getopts will remain an outlier.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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