Re: Empty array referenced by indirection reports unbound variable

2022-02-06 Thread konsolebox
On Mon, Feb 7, 2022, 00:31 Chet Ramey, wrote: > From CHANGES: > > ... Well I'm glad. Thanks again! -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2022-02-06 Thread Chet Ramey
On 2/6/22 4:23 AM, konsolebox wrote: On Thu, Dec 30, 2021 at 4:35 PM Chet Ramey wrote: Let's try it. Thanks for the report. It seems to be already fixed in 5.2-alpha (thanks), but I can't see it mentioned in the changelog. Can you kindly confirm if it really is? From CHANGES: "bb. Array r

Re: Empty array referenced by indirection reports unbound variable

2022-02-06 Thread konsolebox
On Thu, Dec 30, 2021 at 4:35 PM Chet Ramey wrote: > Let's try it. Thanks for the report. It seems to be already fixed in 5.2-alpha (thanks), but I can't see it mentioned in the changelog. Can you kindly confirm if it really is? -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-12-30 Thread konsolebox
On Thu, Dec 30, 2021 at 4:35 PM Chet Ramey wrote: > > On 12/27/21 11:37 PM, konsolebox wrote: > > On Thu, Apr 8, 2021, 06:56 konsolebox, > > wrote: > > > > On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey > > wrote: > > > Indirection

Re: Empty array referenced by indirection reports unbound variable

2021-12-30 Thread Chet Ramey
On 12/27/21 11:37 PM, konsolebox wrote: On Thu, Apr 8, 2021, 06:56 konsolebox, > wrote: On Thu, Apr 8, 2021 at 2:44 AM Chet Ramey mailto:chet.ra...@case.edu>> wrote: > Indirection does not check whether or not the variable it's indirecting > is $@/$* or

Re: Empty array referenced by indirection reports unbound variable

2021-12-27 Thread konsolebox
On Thu, Apr 8, 2021, 06:56 konsolebox, wrote: > 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: > >

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: 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 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 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 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-06 Thread konsolebox
On Tue, Apr 6, 2021 at 11:28 PM Robert Elz wrote: > | @ means everything or nothing. Unbound variable errors should not apply > to it. > > I know nothing about namerefs and arrays and stuff like that, > but did you consider the possibility that after > > array=() > > then > > ar

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread Robert Elz
Date:Tue, 6 Apr 2021 22:39:55 +0800 From:konsolebox Message-ID: | @ means everything or nothing. Unbound variable errors should not apply to it. I know nothing about namerefs and arrays and stuff like that, but did you consider the possibility that after

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread Alex fxmbsw7 Ratchev
im sorry i dont support set -u cant discuss it On Tue, Apr 6, 2021, 16:40 konsolebox wrote: > On Tue, Apr 6, 2021 at 10:38 PM Alex fxmbsw7 Ratchev > wrote: > > > > what i meant was there is not one element defined so .. any reference to > anything in it will be not set.. makes sense @ is not de

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
On Tue, Apr 6, 2021 at 10:38 PM Alex fxmbsw7 Ratchev wrote: > > what i meant was there is not one element defined so .. any reference to > anything in it will be not set.. makes sense @ is not defined > i remember !var worked with it, or at least other defined sub elements @ means everything or

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread Alex fxmbsw7 Ratchev
what i meant was there is not one element defined so .. any reference to anything in it will be not set.. makes sense @ is not defined i remember !var worked with it, or at least other defined sub elements On Tue, Apr 6, 2021, 16:26 konsolebox wrote: > On Tue, Apr 6, 2021 at 9:57 PM Alex fxmbsw7

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
On Tue, Apr 6, 2021 at 9:57 PM Alex fxmbsw7 Ratchev wrote: > > arr=( ) implies no [0]= Also `arr=()` does not imply `arr[0]=`. `arr[0]` remains unset and not assigned to any. Not even an empty string. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread konsolebox
On Tue, Apr 6, 2021 at 9:57 PM Alex fxmbsw7 Ratchev wrote: > > arr=( ) implies no [0]= arr[0] is not exactly being referenced here. -- konsolebox

Re: Empty array referenced by indirection reports unbound variable

2021-04-06 Thread Alex fxmbsw7 Ratchev
arr=( ) implies no [0]= On Mon, Apr 5, 2021, 22:46 konsolebox wrote: > set -u > array=() > __ref=array[@] > : "${array[@]}" # Reports nothing > : "${!__ref}" # Unbound variable > > Using bash version 5.1.4. I know this can be avoided by using namerefs > instead but indirection is more portable w