Fixing coproc race condition bug

2021-10-24 Thread Jim Avera
#!/usr/bin/env bash set -e -u coproc date sleep 1 # In bash 5.0.17, this aborts with "COPROC[0]: unbound variable" # if the coproc exits before the main process gets here. read -u ${COPROC[0]} line # Discussion: # # To prevent this race condition, Bash must not close the coproc output pipe # w

Re: Fixing coproc race condition bug

2021-10-24 Thread Jim Avera
On 10/24/21 1:44 PM, Jim Avera wrote: # Note: Ignore errors when closing pipes, as the user might have manually closed # the fds using 'exec {varname}>&-' or similar. Actually this isn't a good idea because the fd might have been re-used for something else; so an error

set -e in (subshells) does not work independently of outer context

2012-01-24 Thread Jim Avera
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACK

printf -v array[$i] "%b" "" poisons array causing segfault later

2012-02-01 Thread Jim Avera
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACK

backslash at end of input causes eval parse error

2014-08-25 Thread jim . avera
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share

Final backslash causes array assignment mis-parse in previous eval

2014-08-25 Thread jim . avera
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share

"source" cmd creates entry in BASH_SOURCE etc. only if within function

2014-09-02 Thread jim . avera
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share