bug-bash
[Top][All Lists]
Advanced

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

Bash Segmentation fault within lastpipe mode


From: scorp . dev . null
Subject: Bash Segmentation fault within lastpipe mode
Date: Thu, 19 Jun 2014 12:43:12 +0400

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' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib  
-D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat 
-Werror=format-security -Wall
uname output: Linux PCM14 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 
UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 45
Release Status: release

Description:

in case use overwrite variables within "while loop" in  lastpipe mode i get 
"Segmentation fault"

## example script ##
#!/bin/bash
shopt -s lastpipe

allUsersArray=( a b c d e d g)
allActiveArray=( a b )
allSuspendArray=( ${allUsersArray[@]} )

for i in ${!allSuspendArray[@]}
do 
  echo ${i} ${allSuspendArray[${i}]} | 
    while read _USER_ID _USER_NAME
      do 
        for _activeUser in ${allActiveArray[@]}
        do 
          echo ${_activeUser} | 
            grep -E "^${_USER_NAME}$" && unset allSuspendArray[${_USER_ID}]
        done 
      done 

done

echo allUsersArray ${!allUsersArray[@]}
echo allSuspendArray ${!allSuspendArray[@]}
## END example script ##

## trace ##
bash -x  ts.sh
+ shopt -s lastpipe
+ allUsersArray=(a b c d e d g)
+ allActiveArray=(a b)
+ allSuspendArray=(${allUsersArray[@]})
+ for i in '${!allSuspendArray[@]}'
+ read _USER_ID _USER_NAME
+ echo 0 a
+ for _activeUser in '${allActiveArray[@]}'
+ grep -E '^a$'
+ echo a
a
+ for _activeUser in '${allActiveArray[@]}'
+ grep -E '^a$'
+ echo b
+ read _USER_ID _USER_NAME
Segmentation fault
## END trace ##




reply via email to

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