bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

the 100% hanger..


From: Alex fxmbsw7 Ratchev
Subject: the 100% hanger..
Date: Wed, 24 Feb 2021 03:53:36 +0100

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, [],  <unfinished ...>
[pid 11639] getpid( <unfinished ...>
[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},  <unfinished
...>
[pid 11639] close(255 <unfinished ...>
[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, [],  <unfinished ...>
[pid 11633] rt_sigprocmask(SIG_BLOCK, [INT],  <unfinished ...>
[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},  <unfinished ...>
[pid 11633] read(3,  <unfinished ...>
[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
<unfinished ...>
[pid 11633] <... read resumed>"\nprintf 'current keyword %d of %"..., 512)
= 119
[pid 11639] <... write resumed>)        = 119
[pid 11633] read(3,  <unfinished ...>
[pid 11639] read(3, "", 4096)           = 0
[pid 11639] close(3)                    = 0
[pid 11639] exit_group(0)               = ?
[pid 11633] <... read resumed>"", 512)  = 0
[pid 11639] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11639, si_uid=0,
si_status=0, si_utime=0, si_stime=0} ---
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 11639
wait4(-1, 0x7fffd1d2ba98, WNOHANG, NULL) = -1 ECHILD (No child processes)
rt_sigreturn({mask=[INT]})              = 0
close(3)                                = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGINT, {sa_handler=0x55c5974ae490, sa_mask=[],
sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, {sa_handler=SIG_DFL,
sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER,
sa_restorer=0x7fbca46ead60}, {sa_handler=0x55c5974ae490, sa_mask=[],
sa_flags=SA_RESTORER, sa_restorer=0x7fbca46ead60}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
write(2, "++ addkw[1]='\nprintf '\\''current"..., 136++ addkw[1]='
printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s
)\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code"
) = 136
write(2, " '\n", 3 '
)                     = 3
write(2, "++ addkw_i=1\n", 13++ addkw_i=1
)          = 13
write(2, "++ ((  addkws++  ))\n", 20++ ((  addkws++  ))
)   = 20
write(2, "++ addkw_now=$'\\0341\\034'\n", 26++ addkw_now=$'\0341\034'
) = 26
write(2, "++ dat[${addkw_now}take]=0\n", 27++ dat[${addkw_now}take]=0
) = 27
write(2, "++ dat[${addkw_now}code]='\nprint"..., 149++
dat[${addkw_now}code]='
printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s
)\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code"
) = 149
write(2, " '\n", 3 '
)                     = 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
write(2, "+ [[ -v kws[++kws_i] ]]\n", 24+ [[ -v kws[++kws_i] ]]
) = 24
write(2, "+ kws_kw=metest\n", 16+ kws_kw=metest
)       = 16
write(2, "+ kws_p1=$'\\034'\n", 17+ kws_p1=$'\034'
)     = 17
write(2, "+ kws_id=1\n", 11+ kws_id=1
)            = 11
write(2, "+ kws_p2=$'\\0341\\034'\n", 22+ kws_p2=$'\0341\034'
) = 22
write(2, "+ kws_code='\nprintf '\\''current "..., 135+ kws_code='
printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s
)\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code"
) = 135
write(2, " '\n", 3 '
)                     = 3
write(2, "+ [[ ! -n \nprintf 'current keywo"..., 127+ [[ ! -n
printf 'current keyword %d of %d in total ( -> %s <- ) ( code : %s )\n'
$[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code"
) = 127
write(2, "  ]]\n", 5  ]]
)                   = 5
write(2, "+ ((  0 < ( kws_take = 0 )  ))\n", 31+ ((  0 < ( kws_take = 0 )
 ))
) = 31
write(2, "+ kws_args=()\n", 14+ kws_args=()
)         = 14
write(2, "+ eval -- '\nprintf '\\''current k"..., 134+ eval -- '
printf '\''current keyword %d of %d in total ( -> %s <- ) ( code : %s
)\n'\'' $[1+kws_i] ${#kws[@]} "$kws_kw" "$kws_code"
) = 134
write(2, " '\n", 3 '
)                     = 3
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
write(2, "++ printf 'current keyword %d of"..., 210++ 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"
) = 210
write(2, " '\n", 3 '
)                     = 3
brk(0x55c5993c7000)                     = 0x55c5993c7000
write(1, "current keyword 1 of 1 in total "..., 175current 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"
) = 175
write(1, "  )\n", 4  )
)                    = 4
write(2, "+ [[ -v kws[++kws_i] ]]\n", 24+ [[ -v kws[++kws_i] ]]
) = 24
brk(0x55c5993c8000)                     = 0x55c5993c8000
brk(0x55c5993ca000)                     = 0x55c5993ca000
brk(0x55c5993ce000)                     = 0x55c5993ce000
brk(0x55c5993d6000)                     = 0x55c5993d6000
brk(0x55c5993e6000)                     = 0x55c5993e6000
brk(0x55c599406000)                     = 0x55c599406000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca3db7000
brk(0x55c5993e6000)                     = 0x55c5993e6000
mmap(NULL, 524288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca3d37000
munmap(0x7fbca3db7000, 262144)          = 0
mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca3c37000
munmap(0x7fbca3d37000, 524288)          = 0
mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca3a37000
munmap(0x7fbca3c37000, 1048576)         = 0
mmap(NULL, 4194304, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca3637000
munmap(0x7fbca3a37000, 2097152)         = 0
mmap(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0x7fbca2e37000
munmap(0x7fbca3637000, 4194304)         = 0
mmap(NULL, 16777216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fbca1e37000
munmap(0x7fbca2e37000, 8388608)         = 0
mmap(NULL, 33554432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fbc9fe37000
munmap(0x7fbca1e37000, 16777216)        = 0
mmap(NULL, 67108864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fbc9be37000
munmap(0x7fbc9fe37000, 33554432)        = 0
mmap(NULL, 134217728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fbc93e37000
munmap(0x7fbc9be37000, 67108864)        = 0
mmap(NULL, 268435456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7fbc83e37000
munmap(0x7fbc93e37000, 134217728)       = 0
^C--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
strace: Process 11633 detached

bash-5.1#

Attachment: kws
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]