Re: array subscripts act differently for integers(ie. let)

2015-02-19 Thread Chet Ramey
On 2/18/15 4:14 PM, emanuelczi...@cryptolab.net wrote: > tl;dr: thanks! no reply needed; > > Thanks guys. I had a hard time accepting that this is how it's supposed to > work. > I accepted it now. :) Yeah. The expression between (( and )) is word expanded, since (( ... )) is supposed to be exact

Re: array subscripts act differently for integers(ie. let)

2015-02-19 Thread Chet Ramey
On 2/18/15 7:57 PM, Eduardo A. Bustamante López wrote: > On Wed, Feb 18, 2015 at 10:14:10PM +0100, emanuelczi...@cryptolab.net wrote: >> That segfault though: > > I confirm that the segmentation fault is in the latest devel version. Here's the patch I applied, very similar to yours. Chet -- ``

[PATCH] Check malloc return values

2015-02-19 Thread Tobias Stoeckmann
These functions would lead to segmentation faults in case of malloc failures. Therefore, the return values have to be checked for NULL. Please note: The function sh_regmatch allows variable "matches" to be NULL. But if ARRAYS_VARS is defined, the code assumes in a later #ifdef'ed code block that

Bugs in ERR and RETURN traps

2015-02-19 Thread Paul Donohue
I posted bug reports at https://savannah.gnu.org/support/index.php?108738 and https://savannah.gnu.org/support/index.php?108749 but there seems to be very little activity (or none at all?) on the issue tracker, so I figured it might be a good idea to post to the mailing list too. I'm using bash

Re: declare in a function makes a variable unable to be found with declare -p in some cases

2015-02-19 Thread Chet Ramey
On 2/18/15 2:44 PM, Eduardo A. Bustamante López wrote: > Let's wait to see what Chet has to say on that matter. Changes on the devel > branch are not documented, so he's the only one that knows what's going on. All changes are in the changelog (CWRU/CWRU.chlog or CWRU/changelog). A typical chang

Re: declare in a function makes a variable unable to be found with declare -p in some cases

2015-02-19 Thread Chet Ramey
On 2/18/15 2:30 PM, SN wrote: > Thanks for checking it on various versions! In 4.4.0(1)-devel this test > passes for a few variations I tried. For example: > > $ f() { declare -a a="()"; eval "declare -p a"; printf "[%s]\n" > "${a[@]}"; }; f > declare -a a=([0]="()") > [()] > > and > > $ f() {

Re: declare in a function makes a variable unable to be found with declare -p in some cases

2015-02-19 Thread Chet Ramey
On 2/17/15 5:46 PM, Eduardo A. Bustamante López wrote: > You're reporting the behavior of the master branch, but it seems to > be already fixed in devel. I'm not sure about the inconsistency > between: > | "$bash" -c 'declare -a a="()"; declare -p a' > and > | "$bash" -c 'f(){ declare -a a="()

Re: declare in a function makes a variable unable to be found with declare -p in some cases

2015-02-19 Thread Chet Ramey
On 2/16/15 3:38 PM, SN wrote: > By the way, empty arrays seem to be reported as "not set". > a=(); test -v a || echo "not set" > This might be related (or not), but consider that the return > status of `test -v' > is different on a bash version unaffected by the bug

Re: declare in a function makes a variable unable to be found with declare -p in some cases

2015-02-19 Thread Chet Ramey
On 2/16/15 3:38 PM, SN wrote: > Hello all, > > I have found a problem with the declare builtin. > > Patch Level: 33 > Release Status: release > > Description: > Apparently, there is a problem with how bash interprets some > variable assignments. > It only happens in a function (p