[Top][All Lists]

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

Re: Some Special Array Variables Only Kind Of Initialized

From: John R. Graham
Subject: Re: Some Special Array Variables Only Kind Of Initialized
Date: Sat, 11 Jan 2014 17:54:20 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/11/2014 04:55 PM, Chet Ramey wrote:
On 1/10/14, 6:06 PM, John R. Graham wrote:
Some of the automagically created special array variables (GROUPS and DIRSTACK 
for soer; perhaps others) appear to not be fully initialized. Their values 
don't appear correctly in some corner cases until they've been referenced with 
parameter expansion (I think that's the triggering criteria, anyway). The 
following shell dialog illustrates:
Yes. There are a number of dynamic variables whose values are generated
each time they are referenced.  In most cases, they have no values until
the value is generated the first time.

Thank you. I had determined that it was related to dynamic variables. The only 
code that I've found in Bash that doesn't properly generate the values is the 
dump of all
variables when the "set" built-in command is called with no arguments. There's 
a trivial patch that addresses this issue with (I believe) few adverse side effects
(attached). I'd appreciate a review.

One possibly adverse effect is that variables that did not show up in the list 
before do show up now. They all appear to be from your list. Some examples: 
SECONDS, LINENO. Don't know whether this would be considered an issue or not.

- John

Attachment: bash-4.2-set-builtin-fix.patch
Description: Text Data

reply via email to

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