[PATCH] unwind protect for bind -x commands

2023-06-27 Thread Grisha Levit
If SIGINT is received during the execution of a bind -x command, the memory allocated for the saved parser state is leaked and the READLINE_* variables remain in the environment * pcomplete.c,bashline.c: - uw_restore_parser_state,uw_rl_set_signals: move from pcomplete.c to bashline.c *

Re: Enable compgen even when programmable completions are not available?

2023-06-27 Thread Kerin Millar
On Tue, 27 Jun 2023 21:52:53 +0200 of1 wrote: > On 27/06/2023 21:05, Kerin Millar wrote: > > It doesn't work at all for >=5.2. The reason for this is interesting and I > > may make a separate post about it. > > > > Prior to 5.2, it can easily be tricked into printing names that do not > >

Re: +=() can be used to set illegal indices

2023-06-27 Thread Chet Ramey
On 6/27/23 10:30 AM, Emanuele Torre wrote: If an indexed array has no available slots after its last index, +=() will overflow the last index, and set into an illegal negative index, effectively prepending values instead of appending them. Thanks for the report. I think it's reasonable to

Re: Help fixing NativeMessaging host: read 32-bit message

2023-06-27 Thread Wiley Young
> It is politics. All human activity is political in nature. Writing for portability is about building a widget that will appeal to a larger group of customers. Thanks for your thoughts. Wiley

Re: Enable compgen even when programmable completions are not available?

2023-06-27 Thread of1
On 27/06/2023 21:05, Kerin Millar wrote: It doesn't work at all for >=5.2. The reason for this is interesting and I may make a separate post about it. Prior to 5.2, it can easily be tricked into printing names that do not exist. $ VAR=$'\nNONEXISTENT=' ./declare-P | grep ^NONEXISTENT

Re: temp env vs export

2023-06-27 Thread Chet Ramey
On 6/22/23 1:54 PM, Grisha Levit wrote: Using `export' / `readonly' on a variable that's present in both the temp env and a calling function's local context combines the attributes of all the intervening scopes in the global variable: H. Should it even get to this point? Temporary

Re: Enable compgen even when programmable completions are not available?

2023-06-27 Thread Kerin Millar
On Tue, 27 Jun 2023 18:37:37 +0200 Fabien Orjollet wrote: > I'm far from having the skills of the people here. However, I found the > problem interesting. I think I've come up with a reasonable solution > (you tell me). Although it's not as short as Kerin Millar's, I think it > offers some

Re: Enable compgen even when programmable completions are not available?

2023-06-27 Thread Fabien Orjollet
I'm far from having the skills of the people here. However, I found the problem interesting. I think I've come up with a reasonable solution (you tell me). Although it's not as short as Kerin Millar's, I think it offers some improvements. I hope there are no particular weaknesses. If it's of any

Re: xmalloc error involving functrace, int trap and ps4

2023-06-27 Thread Chet Ramey
On 6/25/23 2:18 AM, Wiley Young wrote: Bash Version: 5.2 Patch Level: 15 Release Status: release Hello, A strange error. I don't know what it means exactly, but I'm fairly positive I don't have 18 exabytes on this computer...? Thanks for the report. This is a strange error, requiring

Re: leak in skip_double_quoted for funsub

2023-06-27 Thread Chet Ramey
On 6/26/23 7:34 PM, Grisha Levit wrote: diff --git a/subst.c b/subst.c Thanks for the report. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/

+=() can be used to set illegal indices

2023-06-27 Thread Emanuele Torre
If an indexed array has no available slots after its last index, +=() will overflow the last index, and set into an illegal negative index, effectively prepending values instead of appending them. $ x=([9223372036854775807]=hello) $ x+=( and hi ) $ echo "${x[@]}" and hi hello $

Re: Funny behaviour of associative arrays

2023-06-27 Thread Robert Elz
Date:Tue, 27 Jun 2023 07:44:56 -0400 From:Greg Wooledge Message-ID: | I'm seeing some parser voodoo here. Not doing field splitting, or globbing, is normal for any assignment statement. Consider the simple (no arrays involved) IFS=$', \t\n' var=x*,y? final=$var

Re: Funny behaviour of associative arrays

2023-06-27 Thread Greg Wooledge
On Tue, Jun 27, 2023 at 06:24:30AM -0500, Dennis Williamson wrote: > Your first assignment is a way to assign a list of members to an > associative array. Your second assignment creates a single element with the > index "[a]=b [c]=d" which has a null value. I'm seeing some parser voodoo here.

Re: Funny behaviour of associative arrays

2023-06-27 Thread Robert Elz
Date:Tue, 27 Jun 2023 07:29:42 +0200 From:n952162 Message-ID: I suspect this message really should have gone to the bash-help list. Never mind: | If so, why? I think this is related to the message I sent to the list early this morning (my time) -- bash is

Re: Funny behaviour of associative arrays

2023-06-27 Thread Dennis Williamson
On Tue, Jun 27, 2023 at 12:29 AM n952162 wrote: > Is this correct? > > declare -A l1 > > l1=([a]=b [c]=d) > echo ${!l1[@]} > > l1=($(echo [a]=b [c]=d)) > echo ${!l1[@]} > > $ bash t4 > c a > [a]=b [c]=d > > If so, why? And how can I assign a list of members to an

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 07:29 n952162 wrote: > Is this correct? > > declare -A l1 > > l1=([a]=b [c]=d) > echo ${!l1[@]} > > l1=($(echo [a]=b [c]=d)) > echo ${!l1[@]} > > $ bash t4 > c a > [a]=b [c]=d > > If so, why? And how can I assign a list of members to an associative >

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 11:00 alex xmb ratchev wrote: > > > On Tue, Jun 27, 2023, 07:29 n952162 wrote: > >> Is this correct? >> >> declare -A l1 >> >> l1=([a]=b [c]=d) >> echo ${!l1[@]} >> >> l1=($(echo [a]=b [c]=d)) >> echo ${!l1[@]} >> > > declare -A "l1=( $( echo [ab]=22 )

Re: Funny behaviour of associative arrays

2023-06-27 Thread alex xmb ratchev
On Tue, Jun 27, 2023, 07:29 n952162 wrote: > Is this correct? > > declare -A l1 > > l1=([a]=b [c]=d) > echo ${!l1[@]} > > l1=($(echo [a]=b [c]=d)) > echo ${!l1[@]} > declare -A "l1=( $( echo [ab]=22 ) )" declare -A "l1+=( name content )" l1+=( third 33 ) declare -p l1