-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/19/11 11:12 AM, Dan Douglas wrote: > Hi, This seems to corrupt the array in a way that crashes when trying to > expand the array. Also occurs with the previous patchset. > > ~ $ ( while read -rn 1 'x[y++]'; do :; done < <(printf '%s\n' {0..5}); > declare -p x; echo "${x[@]}" ) > declare -a x='([0]="0" [1]="" [2]="1" [3]="" [4]="2" [5]="" [6]="3" [7]="" > [8]="4" [9]="" [10]="5" [11]="" [12]="")' > 0 1 2 3 4 5 > ~ $ ( while read -rN 1 'x[y++]'; do :; done < <(printf '%s\n' {0..5}); > declare -p x; echo "${x[@]}" ) > declare -a x='([0]="0" [1]= [2]="1" [3]= [4]="2" [5]= [6]="3" [7]= [8]="4" > [9]= [10]="5" [11]= [12]="")' > Segmentation fault
Thanks for the report, and the easy case to reproduce this problem. Try the attached patch; it fixes the problem on my system. Chet - -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7v3gIACgkQu1hp8GTqdKsiNwCcD452x4PwKsOQn9sDMGozNTew JWoAoIuDKHavEWhhEmBhBwCjmiNcOhFo =mtYW -----END PGP SIGNATURE-----
*** ../bash-4.2-patched/builtins/read.def 2011-11-21 18:03:38.000000000 -0500 --- builtins/read.def 2011-12-19 19:52:12.000000000 -0500 *************** *** 738,742 **** } else ! var = bind_read_variable (varname, t); } else --- 775,779 ---- } else ! var = bind_read_variable (varname, t ? t : ""); } else *************** *** 799,803 **** } else ! var = bind_read_variable (list->word->word, input_string); if (var) --- 836,840 ---- } else ! var = bind_read_variable (list->word->word, input_string ? input_string : ""); if (var)