Re: Behaviour of test -v with assoc array and quote character in key
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 be problematic here because, as a shell > builtin, > >> its arguments undergo a round of word expansions before it's invoked. > It's > >> difficult to reliably detect the closing bracket in an array subscript > as a > >> result, even if the array subscript expansion didn't perform any > expansions > >> on its own. (Consider what would happen if $1 were `]'). > > > > You're absolutely right, I didn't consider the ']' case at all! That > would > > obviously break. So indeed this just user-error then and not really a > bug. > > Well, it's less than ideal. This is why I introduced the assoc_expand_once > option, but as many folks on here will tell you, it's not a perfect > solution. This is one of the cases where it's not. > > I think I have a better way to do it, one that doesn't require using an > extra level of quoting or assoc_expand_once, but I'm not ready to commit > anything yet, and builtins like test/[ and let will always cause problems. > > Chet > > -- > ``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/ > >
Re: Behaviour of test -v with assoc array and quote character in key
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) bash: ']: syntax error: operand expected (error token is "']") but: $ (LANG=C; unset var assoc; var=\'\]; declare -A assoc; assoc[$var]=hello; typeset -p assoc) declare -A assoc=(["']"]="hello" ) -- Léa Gris
Re: Behaviour of test -v with assoc array and quote character in key
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 array before: > > > $ (LANG=C; unset var assoc; var=\'\]; assoc[$var]=hello; typeset -p > assoc) > > bash: ']: syntax error: operand expected (error token is "']") > > but: > > > $ (LANG=C; unset var assoc; var=\'\]; declare -A assoc; > assoc[$var]=hello; typeset -p assoc) > > declare -A assoc=(["']"]="hello" ) > > > > > -- > Léa Gris > > >
Assign read-only variables return code not usable inline
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 || exit 2 still there with $?=1, after: if ! r='hello'; then exit; fi declare -r r -- Léa Gris
Re: Behaviour of test -v with assoc array and quote character in key
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 math contexts are dodgy as hell. No amount of quoting will make (( 'assoc[$var]'++ )) work. If you want to increment the value of this array element, you'll need to retrieve it into a temporary string variable, increment that, and then copy it back into the array.
Re: Behaviour of test -v with assoc array and quote character in key
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 quotes for [[ -v 'assoc[$var]' ]] to work, and math contexts are dodgy as hell. No amount of quoting will make (( 'assoc[$var]'++ )) work. If you want to increment the value of this array element, you'll need to retrieve it into a temporary string variable, increment that, and then copy it back into the array. Works, if you declare your associative array with A and i flags: ( LANG=C unset var assoc var=\'\] declare -Ai assoc assoc[$var]=1 assoc[$var]+=1 ((assoc['$var']++)) typeset -p assoc ) Output: declare -Ai assoc=(["']"]="3" ) -- Léa Gris
Re: Behaviour of test -v with assoc array and quote character in key
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
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 well -- I get the same results with or without it (for the command with (( )) in it).
Re: Behaviour of test -v with assoc array and quote character in key
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 contents of the variable named var.
Re: Assign read-only variables return code not usable inline
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'); `exit 2' is unreachable there. -- Oğuz
Re: Behaviour of test -v with assoc array and quote character in key
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 assoc[$var]. Yours uses the literal string var > as the key, not the contents of the variable named var. `(( assoc[\$var]++ ))' works fine as usual. -- Oğuz
Re: Behaviour of test -v with assoc array and quote character in key
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]'++ )) bash-5.1: ((: 'hash[']]'++ : syntax error: operand expected (error token is "'hash[']]'++ ") unicorn:~$ (( hash['$key']++ )) bash-5.1: ((: hash['']']++ : syntax error: invalid arithmetic operator (error token is "']++ ") unicorn:~$ (( hash['$'key]++ )) unicorn:~$ declare -p hash declare -A hash=(["\$key"]="1" ["']"]="18" ) I understand absolutely none of this. Quoting the $ works, but only if you quote it with a backslash, not with single quotes? And quoting any other characters besides the $ fails? Sorry, I'm still going with "this stuff's broken -- don't use it".
Re: Behaviour of test -v with assoc array and quote character in key
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 -p hash > declare -A hash=(["']"]="18" ) > unicorn:~$ (( 'hash[$key]'++ )) > bash-5.1: ((: 'hash[']]'++ : syntax error: operand expected (error token > is "'hash[']]'++ ") > unicorn:~$ (( hash['$key']++ )) > bash-5.1: ((: hash['']']++ : syntax error: invalid arithmetic operator > (error token is "']++ ") > unicorn:~$ (( hash['$'key]++ )) > unicorn:~$ declare -p hash > declare -A hash=(["\$key"]="1" ["']"]="18" ) > > I understand absolutely none of this. Quoting the $ works, but only > if you quote it with a backslash, not with single quotes? And quoting > any other characters besides the $ fails? Neither do I :D I was told in this list that quote removal rules for `(( ... ))' were changed recently, but I have yet to understand why and how. > > Sorry, I'm still going with "this stuff's broken -- don't use it". > I agree with this. -- Oğuz
Re: Assign read-only variables return code not usable inline
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 omitted the error messages bash prints). POSIX says a non-interactive shell must exit, which bash does in posix mode. An interactive shell doesn't exit, but POSIX says "the shell shall not perform any further processing of the command in which the error occurred." That command is the and-or list the shell is executing; the shell jumps back to the top-level processing loop. Bash does this in interactive and non-interactive shells in default mode. -- ``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/
Re: Shell Grammar man page
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-definition These are basically the `command' productions from the grammar. The exception is `list', and it's there because it would be strange for the reader if it were presented before simple commands and pipelines, which users are more likely to encounter, even though a complete command is technically a list. Simplified, a pipeline is: [ ! ] command1 [ | command2 ] A list is a sequence of pipelines separated by ;, &, &&, or || and optionally terminated by ;, & or NL. Within the list description, the and-list and or-list are described as: and-list: command1 && command2 or-list: command1 || command2 Though the text says that and/or-lists are sequences of pipelines (separated by && or ||). `command1' and `command2' are meta-notation, not a grammar production. That is slightly inconsistent. Not really. A pipeline can be reduced to a command. In a sense, yes, depending on your definition of `command'. In that case, the and/or list should read: and-list: pipeline1 && pipeline2 or-list: pipeline1 || pipeline2 No, it really shouldn't. The bash grammar is a little messier than that POSIX grammar in https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02 but it's basically the same. Where are you trying to go with this? -- ``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/
Re: building 5.1.3 -- some probs...
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 Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
Re: Behaviour of test -v with assoc array and quote character in key
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=(["']"]="18" ) unicorn:~$ (( 'hash[$key]'++ )) bash-5.1: ((: 'hash[']]'++ : syntax error: operand expected (error token is "'hash[']]'++ ") unicorn:~$ (( hash['$key']++ )) bash-5.1: ((: hash['']']++ : syntax error: invalid arithmetic operator (error token is "']++ ") You're so close to getting it. Pay attention to the error message. The contents of (( are expanded as if they are between double quotes (as documented, and like $((expression)) ). Single quotes aren't special in double quotes, so they don't matter and are preserved in the expression that gets passed to the evaluator, which is as in the error message (`hash['']']++'). The closing bracket is ambiguous. In retrospect, the issue is having the expression evaluator treat the array subscript as somehting to be expanded, but that was the consequence of the decision to treat subscripts consistently across different contexts. -- ``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/
another mail try for the hang 100% cpu alias run bug
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 tyring to figure this issue ogt1/ogt is the main linker script that binds via aliases/+alias aliases from file named content, and +kw for assoc array keywords to eval system then ok till now, then i go test the aliases/kws code that evals per keyword, but it hangs right after the first line that says some_value=-1 what would follow is the while [[ -v some_var[++some_value ]] loop for processing ... the =-1 appears, then hangs, no other set -x output included is also to the archive the kws alias code, maybe you can see an error, maybe not, :)) to explain the assoc array system a bit deeper: s=subsep ; namespace=empty arr[ kw ] should expand to an id useable for: arr[ ] = value and in kws simply eval the code part its not much finished but its very far ogt1.tgz Description: application/compressed-tar kws Description: Binary data
Re: Shell Grammar man page
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 GRAMMAR' describes: > > - simple-command > > - pipeline > > - list > > - compound-command > > - coproc > > - function-definition > > These are basically the `command' productions from the grammar. The > exception is `list', and it's there because it would be strange for > the reader if it were presented before simple commands and pipelines, > which users are more likely to encounter, even though a complete > command is technically a list. It is mostly recursive, so you have to start somewhere. Your reasoning is understandable. Start with what the reader knows. Though the readers are likely to be familiar with grammars/rules/start symbols. Because 'command' is not described, a reader might think that all these items are commands. > > Simplified, a pipeline is: > > [ ! ] command1 [ | command2 ] > > > > A list is a sequence of pipelines separated by ;, &, &&, or || > > and optionally terminated by ;, & or NL. > > > > Within the list description, the and-list and or-list are described as: > > and-list: command1 && command2 > > or-list: command1 || command2 > > Though the text says that and/or-lists are sequences of pipelines > > (separated by && or ||). > > `command1' and `command2' are meta-notation, not a grammar production. I know. It is just as the man page describes it. The numbering is quite handy for referring in the text. > > That is slightly inconsistent. > Not really. > > > A pipeline can be reduced to a command. > In a sense, yes, depending on your definition of `command'. That is the point. The documentation never describes what a 'command' is. The inconsistency comes when you try to follow the documentation's use of 'command'. It is only in the words, not in the real grammar of course. > > In that case, the and/or list should read: > > and-list: pipeline1 && pipeline2 > > or-list: pipeline1 || pipeline2 > > No, it really shouldn't. You're right. These pipelines should be lists. In the mean time i have looked into parse.y The grammar is quite readable. Good. > The bash grammar is a little messier than that POSIX grammar in > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02 > but it's basically the same. Thanks for the link. > Where are you trying to go with this? I have been wondering about this (missing command description) for some time. Before even trying to submit a rewrite, i wanted to make it more clear. For me, it is clear now. But i am not sure whether a rewrite is worth the trouble. It is also a bit problematic that the word 'command' is overloaded. We give commands, not lists. Though a pipeline might be entered ;) Regards, Mike Jonkmans
addition to the hung 100% cpu bug, just some strace output
..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${SUBSEP}kw$SUBSEP${addkw[addkw_i]}]=1 ) = 53 write(2, "++ [[ -v addkw[++addkw_i] ]]\n", 29++ [[ -v addkw[++addkw_i] ]] ) = 29 write(2, "++ [[ -v addkwf[++addkwf_i] ]]\n", 31++ [[ -v addkwf[++addkwf_i] ]] ) = 31 write(2, "+ kws=(metest)\n", 15+ kws=(metest) )= 15 write(2, "+ kws_i=-1\n", 11+ kws_i=-1 )= 11 brk(0x5626989a4000) = 0x5626989a4000 brk(0x5626989a5000) = 0x5626989a5000 brk(0x5626989a7000) = 0x5626989a7000 brk(0x5626989ab000) = 0x5626989ab000 brk(0x5626989b3000) = 0x5626989b3000 brk(0x5626989c3000) = 0x5626989c3000 brk(0x5626989e3000) = 0x5626989e3000 mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364fedf000 brk(0x5626989c3000) = 0x5626989c3000 mmap(NULL, 524288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364fe5f000 munmap(0x7f364fedf000, 262144) = 0 mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364fd5f000 munmap(0x7f364fe5f000, 524288) = 0 mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364fb5f000 munmap(0x7f364fd5f000, 1048576) = 0 mmap(NULL, 4194304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364f75f000 munmap(0x7f364fb5f000, 2097152) = 0 mmap(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364ef5f000 munmap(0x7f364f75f000, 4194304) = 0 mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364df5f000 munmap(0x7f364ef5f000, 8388608) = 0 mmap(NULL, 33554432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f364bf5f000 munmap(0x7f364df5f000, 16777216)= 0 mmap(NULL, 67108864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3647f5f000 munmap(0x7f364bf5f000, 33554432)= 0 mmap(NULL, 134217728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f363ff5f000 munmap(0x7f3647f5f000, 67108864)= 0 mmap(NULL, 268435456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f362ff5f000 munmap(0x7f363ff5f000, 134217728) = 0 mmap(NULL, 536870912, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f360ff5f000 munmap(0x7f362ff5f000, 268435456) = 0 ^C--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} --- strace: Process 10181 detached
the 100% hanger..
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 normally i added by some irc bug chat a printf after the first line which is var definement sorry, second: in aliases its first line be var assignments, second then commands, and ends mostly on purpose with newline and a space i added a printf.. the hung versions never seen that printf, they stuck out the bug is somewhere in alias var assignment codes kws Description: Binary data
the 100% hanger..
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 ogt_demo current keyword 1 of 1 in total ( -> metest <- ) ( code : printf 'current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ) ^C bash-5.1# + kws_i=-1 + [[ -v kws[++kws_i] ]] + kws_kw=metest + kws_p1=$'\034' + kws_id=1 + kws_p2=$'\0341\034' + kws_code=' printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ' + [[ ! -n printf 'current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ]] + (( 0 < ( kws_take = 0 ) )) + kws_args=() + eval -- ' printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ' ++ printf 'current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n' 1 1 metest ' printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ' current keyword 1 of 1 in total ( -> metest <- ) ( code : printf 'current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code" ) + [[ -v kws[++kws_i] ]] ^C rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 pipe([3, 4])= 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, [INT TERM CHLD], [], 8) = 0 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 11639 attached , child_tidptr=0x7fbca46aca10) = 11639 [pid 11633] rt_sigprocmask(SIG_SETMASK, [], [pid 11639] getpid( [pid 11633] <... rt_sigprocmask resumed>NULL, 8) = 0 [pid 11639] <... getpid resumed>) = 11639 [pid 11633] rt_sigaction(SIGCHLD, {sa_handler=0x55c5974b0f70, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, [pid 11639] close(255 [pid 11633] <... rt_sigaction resumed>{sa_handler=0x55c5974b0f70, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] <... close resumed>)= 0 [pid 11633] close(4)= 0 [pid 11639] rt_sigprocmask(SIG_SETMASK, [], [pid 11633] rt_sigprocmask(SIG_BLOCK, [INT], [pid 11639] <... rt_sigprocmask resumed>NULL, 8) = 0 [pid 11633] <... rt_sigprocmask resumed>[], 8) = 0 [pid 11639] rt_sigaction(SIGTSTP, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, [pid 11633] read(3, [pid 11639] <... rt_sigaction resumed>{sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGTTIN, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGTTOU, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGQUIT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, {sa_handler=0x55c5974b0f70, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGCHLD, {sa_handler=0x55c5974b0f70, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] rt_sigaction(SIGINT, {sa_handler=0x55c5974d18a0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0 [pid 11639] dup2(4, 1) = 1 [pid 11639] close(4)= 0 [pid 11639] close(3)= 0 [pid 11639] rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 [pid 11639] openat(AT_FDCWD, "/root/ogt1/keywords/metest", O_RDONLY) = 3 [pid 11639] read(3, "\nprintf 'current keyword %d of %"..., 4096) = 119 [pid 11639] write(1, "\nprintf 'current keyword %d of %"..., 119 [pid 11633] <... read resumed>"\nprintf 'current keyword %d of %"..., 512) = 119 [pid 11639] <... write resumed>)= 119 [pid 11633] read(
the 100% hanger..
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 second which should fail cause there is only 1 elem in $kws[ it hangs , with brks and memmapps growing rapidly peace, i analyzed well i think please :)) metest Description: Binary data
the 100% hanger..
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 arr[0]