Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread Chet Ramey
On 4/5/21 4:45 PM, konsolebox wrote: set -u array=() __ref=array[@] : "${array[@]}" # Reports nothing This is a special case, mirroring the special case that POSIX carved out for $@ and $* in 2009. : "${!__ref}" # Unbound variable But this is not. Bash looks for __ref, finds it with a value

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread konsolebox
On Wed, Apr 7, 2021 at 9:25 PM Chet Ramey wrote: > > On 4/5/21 4:45 PM, konsolebox wrote: > > set -u > > array=() > > __ref=array[@] > > : "${array[@]}" # Reports nothing > > This is a special case, mirroring the special case that POSIX carved out > for $@ and $* in 2009. > > > : "${!__ref}" # Unb

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread Alex fxmbsw7 Ratchev
set sets args, and exits null no bug there On Wed, Apr 7, 2021, 16:40 konsolebox wrote: > On Wed, Apr 7, 2021 at 9:25 PM Chet Ramey wrote: > > > > On 4/5/21 4:45 PM, konsolebox wrote: > > > set -u > > > array=() > > > __ref=array[@] > > > : "${array[@]}" # Reports nothing > > > > This is a spec

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread Chet Ramey
On 4/7/21 10:39 AM, konsolebox wrote: On Wed, Apr 7, 2021 at 9:25 PM Chet Ramey wrote: On 4/5/21 4:45 PM, konsolebox wrote: set -u array=() __ref=array[@] : "${array[@]}" # Reports nothing This is a special case, mirroring the special case that POSIX carved out for $@ and $* in 2009. : "$

Re: Empty array referenced by indirection reports unbound variable

2021-04-07 Thread konsolebox
On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey wrote: > Indirection does not check whether or not the variable it's indirecting > is $@/$* or ${array[@/*]}. It simply goes by the return value. It looks like it can easily be fixed with this: diff --git a/subst.c b/subst.c index 4f12f22d..cc9a6803 1006

Re: select syntax violates the POLA

2021-04-07 Thread Dale R. Worley
Robert Elz writes: > You're assuming that the manual is a precise specification of what > is allowed. Um, of course. "The documentation is the contract between the user and the implementer." If something undocumented happens to work, there is no requirement on the implementer to maintain its fu