bash-4.3 bug report

2014-04-14 Thread David Binderman
Hello there,  [bind.c:2238]: (style) Array index 'j' is used before limits check. Source code is   for (j = 0; invokers[j] && j < 5; j++) Suggest new code   for (j = 0; (j < 5) && (invokers[j] != NULL); j++) Regards David Binderman

Bash-4.2 Official Patch 47

2014-04-14 Thread Chet Ramey
BASH PATCH REPORT = Bash-Release: 4.2 Patch-ID: bash42-047 Bug-Reported-by:Matthew Riley Bug-Reference-ID: Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2013-03/msg00047.html

bind -x and multiple prompt/command lines

2014-04-14 Thread Rob Foehl
When executing shell commands bound to key sequences with bind -x, the initial line(s) of multiple line shell prompts and/or commands are left intact; when the prompt is redisplayed, the initial line(s) are output again, causing the appearance of duplicate lines. This seems to be due to the co

Re: bash-4.3 bug report

2014-04-14 Thread Chet Ramey
On 4/14/14, 5:34 AM, David Binderman wrote: > Hello there, > > [bind.c:2238]: (style) Array index 'j' is used before limits check. > > Source code is > > for (j = 0; invokers[j] && j < 5; j++) > > Suggest new code > > for (j = 0; (j < 5) && (invokers[j] != NULL); j++) Can

Re: bash-4.3 bug report

2014-04-14 Thread Andreas Schwab
Eric Blake writes: > It silences static code checkers and avoids undefined C behavior. > > Also, if invokers[] is allocated such that it ends on the end of a page > boundary (such as might be the case under certain malloc debuggers), > then doing the bounds check first will avoid an out-of-bounds

Re: bash-4.3 bug report

2014-04-14 Thread Eric Blake
On 04/14/2014 08:50 AM, Chet Ramey wrote: > On 4/14/14, 5:34 AM, David Binderman wrote: >> Hello there, >> >> [bind.c:2238]: (style) Array index 'j' is used before limits check. >> >> Source code is >> >> for (j = 0; invokers[j] && j < 5; j++) >> >> Suggest new code >> >> for (

Re: bash-4.3 bug report

2014-04-14 Thread Eric Blake
On 04/14/2014 09:26 AM, Andreas Schwab wrote: > Eric Blake writes: > >> It silences static code checkers and avoids undefined C behavior. >> >> Also, if invokers[] is allocated such that it ends on the end of a page >> boundary (such as might be the case under certain malloc debuggers), >> then d

Re: bash-4.3 bug report

2014-04-14 Thread Andreas Schwab
Eric Blake writes: > In that case, the index check is dead code, No. You don't understand. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."

Re: bash-4.3 bug report

2014-04-14 Thread Eric Blake
On 04/14/2014 09:35 AM, Andreas Schwab wrote: > Eric Blake writes: > >> In that case, the index check is dead code, > > No. You don't understand. Fair enough. But my point remains to the original poster: a patch without justification is unlikely to be applied. Document WHY you think the exist

Re: bash-4.3 bug report

2014-04-14 Thread Chet Ramey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 4/14/14, 11:19 AM, Eric Blake wrote: > On 04/14/2014 08:50 AM, Chet Ramey wrote: >> On 4/14/14, 5:34 AM, David Binderman wrote: >>> Hello there, >>> >>> [bind.c:2238]: (style) Array index 'j' is used before limits check. >>> >>> Source code is >>>

RE: bash-4.3 bug report

2014-04-14 Thread David Binderman
Hello there, > But my point remains to the original poster: a patch > without justification is unlikely to be applied. Document WHY you think > the existing code is a bug, not just HOW to fix it, for your patch to be > usefully considered. Standard softwar

Re: bash-4.3 bug report

2014-04-14 Thread Eric Blake
On 04/14/2014 10:22 AM, David Binderman wrote: > Hello there, > > >> But my point remains to the original poster: a patch >> without justification is unlikely to be applied. Document WHY you think >> the existing code is a bug, not just HOW to fix it, for y

Re: bash-4.3 bug report

2014-04-14 Thread Dave Rutherford
On Mon, Apr 14, 2014 at 12:22 PM, David Binderman wrote: > Anyone experienced looking at the code will always need to examine it > more closely to find out why it's a good idea in this case to use an array > index and *then* sanity check it's value. But in this case it's a limiting check, not a b

Re: bash-4.3 bug report

2014-04-14 Thread Dennis Williamson
On Apr 14, 2014 11:52 AM, "Dave Rutherford" wrote: > > On Mon, Apr 14, 2014 at 12:22 PM, David Binderman wrote: > > Anyone experienced looking at the code will always need to examine it > > more closely to find out why it's a good idea in this case to use an array > > index and *then* sanity chec

Issue when using job control and SIGCHLD with bash 4.3 (trap is not being run)

2014-04-14 Thread Eduardo A . Bustamante López
Hi, I was playing with set -m and trapping CHLD in a script, and found the following error: $ cat setm-bad.bash set -m i=0 trap ':; ((++i<5)) && { f & }' CHLD f(){ echo x; } f & wait $ cat setm.bash set -m i=0 trap '((++i<5)) && { f & }' CHLD f(){ echo x; } f & wait $ cat reproduce.bash for b

Re: Issue when using job control and SIGCHLD with bash 4.3 (trap is not being run)

2014-04-14 Thread Chet Ramey
On 4/14/14, 4:25 PM, Eduardo A. Bustamante López wrote: > Hi, > > I was playing with set -m and trapping CHLD in a script, and found > the following error: Thanks for the report. I'll take a look. > As you can notice, bash 4.3 exits earlier. It should do 5 iterations, > but instead, it only com