the 100% hanger..

2021-02-23 Thread Alex fxmbsw7 Ratchev
the last analyzement of the weirdness is arr=( .. ) _alias_ then it at least runs thru one arr[0], which is set, and evals the code right and working, however on the next [[ -v arr[1] ]] ( empty ) check it hangs if i dont write the newline after arr=( .. ) for like usual, i get hung on already a

the 100% hanger..

2021-02-23 Thread Alex fxmbsw7 Ratchev
by second [[ -v arr[elem] ]] n after hangs i mean i have two parts in this one is the kws index array with keywords to parse, the other is kws the alias that parses the ${kws[@]} arr so for the first element there in the last mail it worked and displayed the content of the alias, as the code but on

the 100% hanger..

2021-02-23 Thread Alex fxmbsw7 Ratchev
so i fixed the code to have a newline before using the kws alias it, to my half surprise, works perfectly, it displays the metest keyword right, but on the second [[ -v arr[elem] ]] check it hangs, probably brk ing few then mmaping and unmapping much, == bug ? :) bash-5.1# bash ogt_demo + bash

the 100% hanger..

2021-02-23 Thread Alex fxmbsw7 Ratchev
sorry for changing topics, i try .. its still the same topic code the code (error, bug) is included in 'kws' which is supposed to eval set keywords i do kws=( something ) kws it hangs i do kws=( something ) ; kws it hangs i do only kws ( when the var is set already from last time ) it processes n

addition to the hung 100% cpu bug, just some strace output

2021-02-23 Thread Alex fxmbsw7 Ratchev
..based on it, c pros, you can prolly see clearly whats wrong it like mmaps more and more memory beeing slower every run ) = 3 write(2, "++ [[ -v addkw[++addkw_i] ]]\n", 29++ [[ -v addkw[++addkw_i] ]] ) = 29 write(2, "++ dat[$nspace${SUBSEP}kw$SUBSEP"..., 53++ dat[$nspace${SUB

Re: Shell Grammar man page

2021-02-23 Thread Mike Jonkmans
On Tue, Feb 23, 2021 at 04:33:44PM -0500, Chet Ramey wrote: > On 2/22/21 8:11 AM, Mike Jonkmans wrote: > > > > Hi, > > > > It seems some things are missing in the bash manual. > > Notably definition of command and placements of coproc- and > > function-definition. > > > > The section 'SHELL GRA

another mail try for the hang 100% cpu alias run bug

2021-02-23 Thread Alex fxmbsw7 Ratchev
i cannot exclude it'd be my bug ( again ) but i dunno i have no choise than trying to present the hanger to you folks to fix it if you'd unpack ogt1.tgz ull find ogt1/ and some dirs and scripts, the code from the other paste didnt change, i just try to explain it so you dont have a that hard time t

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Chet Ramey
On 2/23/21 10:55 AM, Greg Wooledge wrote: Oğuz (oguzismailuy...@gmail.com) wrote: `(( assoc[\$var]++ ))' works fine as usual. unicorn:~$ bash-5.1 unicorn:~$ declare -A hash unicorn:~$ key=\'\] unicorn:~$ hash[$key]=17 unicorn:~$ (( hash[\$key]++ )) unicorn:~$ declare -p hash declare -A hash=([

Re: building 5.1.3 -- some probs...

2021-02-23 Thread Chet Ramey
On 2/22/21 10:09 PM, L A Walsh wrote: export _home_prefix=${HOME%/*}/ I can't reproduce it, though I'm sure this is the line where it crashes for you. What is HOME set to? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates C

Re: Shell Grammar man page

2021-02-23 Thread Chet Ramey
On 2/22/21 8:11 AM, Mike Jonkmans wrote: Hi, It seems some things are missing in the bash manual. Notably definition of command and placements of coproc- and function-definition. The section 'SHELL GRAMMAR' describes: - simple-command - pipeline - list - compound-command - coproc - function-de

Re: Assign read-only variables return code not usable inline

2021-02-23 Thread Chet Ramey
On 2/23/21 7:54 AM, Léa Gris wrote: https://ideone.com/iw2pSv #!/usr/bin/env bash declare -r r r=2 || exit 2 OK, let's pick this one. This is what POSIX calls a "variable assignment error" in https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_01 (you've om

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Oğuz
23 Şubat 2021 Salı tarihinde Greg Wooledge yazdı: > Oğuz (oguzismailuy...@gmail.com) wrote: > > `(( assoc[\$var]++ ))' works fine as usual. > > unicorn:~$ bash-5.1 > unicorn:~$ declare -A hash > unicorn:~$ key=\'\] > unicorn:~$ hash[$key]=17 > unicorn:~$ (( hash[\$key]++ )) > unicorn:~$ declare -

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Greg Wooledge
Oğuz (oguzismailuy...@gmail.com) wrote: > `(( assoc[\$var]++ ))' works fine as usual. unicorn:~$ bash-5.1 unicorn:~$ declare -A hash unicorn:~$ key=\'\] unicorn:~$ hash[$key]=17 unicorn:~$ (( hash[\$key]++ )) unicorn:~$ declare -p hash declare -A hash=(["']"]="18" ) unicorn:~$ (( 'hash[$key]'++ ))

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Oğuz
23 Şubat 2021 Salı tarihinde Greg Wooledge yazdı: > On Tue, Feb 23, 2021 at 02:03:55PM +0100, Andreas Schwab wrote: > > On Feb 23 2021, Greg Wooledge wrote: > > > > > No amount of quoting will make (( 'assoc[$var]'++ )) work. > > > > (( assoc[var]++ )) > > > > Andreas. > > This is not the same as

Re: Assign read-only variables return code not usable inline

2021-02-23 Thread Oğuz
23 Şubat 2021 Salı tarihinde Léa Gris yazdı: > https://ideone.com/iw2pSv > > #!/usr/bin/env bash >> declare -r r >> r=2 || exit 2 > > There is no command substitution in `r=2', it will either succeed and return zero, or fail and cause the shell to discard the whole command (`r=2 || exit 2'); `e

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Greg Wooledge
On Tue, Feb 23, 2021 at 02:03:55PM +0100, Andreas Schwab wrote: > On Feb 23 2021, Greg Wooledge wrote: > > > No amount of quoting will make (( 'assoc[$var]'++ )) work. > > (( assoc[var]++ )) > > Andreas. This is not the same as assoc[$var]. Yours uses the literal string var as the key, not the

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Greg Wooledge
On Tue, Feb 23, 2021 at 02:03:30PM +0100, Léa Gris wrote: > ( > LANG=C > unset var assoc > var=\'\] > declare -Ai assoc > assoc[$var]=1 > assoc[$var]+=1 > ((assoc['$var']++)) > typeset -p assoc > ) This "works" in bash 5.0 but not in Debian's bash 5.1. The -i flag is irrelevant as

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Andreas Schwab
On Feb 23 2021, Greg Wooledge wrote: > No amount of quoting will make (( 'assoc[$var]'++ )) work. (( assoc[var]++ )) Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Léa Gris
Le 23/02/2021 à 13:55, Greg Wooledge écrivait : On Tue, Feb 23, 2021 at 12:17:10PM +0100, Alex fxmbsw7 Ratchev wrote: what, sorry, mailing stuff isnt much clear to me, ... its not possible to have a var=\'\] ; assoc[$var] ? It should work for simple assignment and retrieval. You need to add q

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Greg Wooledge
On Tue, Feb 23, 2021 at 12:17:10PM +0100, Alex fxmbsw7 Ratchev wrote: > what, sorry, mailing stuff isnt much clear to me, ... its not possible to > have a var=\'\] ; assoc[$var] ? It should work for simple assignment and retrieval. You need to add quotes for [[ -v 'assoc[$var]' ]] to work, and ma

Assign read-only variables return code not usable inline

2021-02-23 Thread Léa Gris
https://ideone.com/iw2pSv #!/usr/bin/env bash declare -r r r=2 || exit 2 echo 'still there with $?='$?', after: r=2 || exit 2' if ! r='hello'; then exit; fi echo "still there with \$?=$?, after: if ! r='hello'; then exit; fi" typeset -p r Output: still there with $?=1, after: r=2

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Alex fxmbsw7 Ratchev
yeah i thought so.. thanks On Tue, Feb 23, 2021 at 12:52 PM Léa Gris wrote: > Le 23/02/2021 à 12:17, Alex fxmbsw7 Ratchev écrivait : > > what, sorry, mailing stuff isnt much clear to me, ... its not possible to > > have a var=\'\] ; assoc[$var] ? > > You can if assoc is declared an associative a

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Léa Gris
Le 23/02/2021 à 12:17, Alex fxmbsw7 Ratchev écrivait : what, sorry, mailing stuff isnt much clear to me, ... its not possible to have a var=\'\] ; assoc[$var] ? You can if assoc is declared an associative array before: $ (LANG=C; unset var assoc; var=\'\]; assoc[$var]=hello; typeset -p assoc)

Re: Behaviour of test -v with assoc array and quote character in key

2021-02-23 Thread Alex fxmbsw7 Ratchev
what, sorry, mailing stuff isnt much clear to me, ... its not possible to have a var=\'\] ; assoc[$var] ? On Mon, Feb 22, 2021 at 5:48 PM Chet Ramey wrote: > On 2/15/21 1:28 PM, Daniel Gröber wrote: > > > On Mon, Feb 15, 2021 at 09:11:48AM -0500, Chet Ramey wrote: > >> `test' is always going to