]>
Commit | Line | Data |
---|---|---|
4e9fe84f JB |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 3.0 | |
5 | Patch-ID: bash30-001 | |
6 | ||
7 | Bug-Reported-by: Karlheinz Nolte <kn@k-nolte.de> | |
8 | Bug-Reference-ID: <20040801200058.GA3311@mars.home.k-nolte.de> | |
9 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00009.html | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | The following script triggers the segfault. | |
14 | This was found by Costa Tsaousis the author of FireHOL. | |
15 | He wrotes: | |
16 | ||
17 | "I think I have found the bug. The script bellow crashes at the | |
18 | third echo (UNSET). It seems to be a problem of the "unset" BASH | |
19 | function when erasing arrays. It leaves something behind so that if | |
20 | the array just unset is referenced, it produces a segmentation fault. | |
21 | According to the documentation the first and the third expansions | |
22 | should be exactly the same." | |
23 | ||
24 | Patch: | |
25 | ||
26 | *** ../bash-3.0/arrayfunc.c Fri Dec 19 00:03:09 2003 | |
27 | --- arrayfunc.c Sun Aug 1 20:43:00 2004 | |
28 | *************** | |
29 | *** 612,616 **** | |
30 | ||
31 | free (t); | |
32 | ! return var; | |
33 | } | |
34 | ||
35 | --- 612,616 ---- | |
36 | ||
37 | free (t); | |
38 | ! return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var; | |
39 | } | |
40 | ||
41 | ||
42 | *** ../bash-3.0/subst.c Sun Jul 4 13:56:13 2004 | |
43 | --- subst.c Thu Aug 12 13:36:17 2004 | |
44 | *************** | |
45 | *** 4983,4987 **** | |
46 | return -1; | |
47 | } | |
48 | ! else if ((v = find_variable (varname)) && array_p (v)) | |
49 | { | |
50 | vtype = VT_ARRAYMEMBER; | |
51 | --- 5003,5007 ---- | |
52 | return -1; | |
53 | } | |
54 | ! else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v)) | |
55 | { | |
56 | vtype = VT_ARRAYMEMBER; | |
57 | ||
58 | *** ../bash-3.0/variables.c Sun Jul 4 13:57:26 2004 | |
59 | --- variables.c Wed Aug 4 15:28:04 2004 | |
60 | *************** | |
61 | *** 1420,1428 **** | |
62 | ||
63 | # if defined (DEBUGGER) | |
64 | ! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, (att_invisible|att_noassign)); | |
65 | ! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, (att_invisible|att_noassign)); | |
66 | # endif /* DEBUGGER */ | |
67 | ! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, (att_invisible|att_noassign)); | |
68 | ! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, (att_invisible|att_noassign)); | |
69 | #endif | |
70 | ||
71 | --- 1420,1428 ---- | |
72 | ||
73 | # if defined (DEBUGGER) | |
74 | ! v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign); | |
75 | ! v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign); | |
76 | # endif /* DEBUGGER */ | |
77 | ! v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign); | |
78 | ! v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign); | |
79 | #endif | |
80 | ||
81 | *************** | |
82 | *** 1600,1604 **** | |
83 | old_var = find_variable (name); | |
84 | if (old_var && local_p (old_var) && old_var->context == variable_context) | |
85 | ! return (old_var); | |
86 | ||
87 | was_tmpvar = old_var && tempvar_p (old_var); | |
88 | --- 1600,1607 ---- | |
89 | old_var = find_variable (name); | |
90 | if (old_var && local_p (old_var) && old_var->context == variable_context) | |
91 | ! { | |
92 | ! VUNSETATTR (old_var, att_invisible); | |
93 | ! return (old_var); | |
94 | ! } | |
95 | ||
96 | was_tmpvar = old_var && tempvar_p (old_var); | |
97 | *** ../bash-3.0/pcomplete.c Thu Jan 8 10:36:17 2004 | |
98 | --- pcomplete.c Tue Aug 3 23:15:41 2004 | |
99 | *************** | |
100 | *** 864,867 **** | |
101 | --- 864,869 ---- | |
102 | v = convert_var_to_array (v); | |
103 | v = assign_array_var_from_word_list (v, lwords); | |
104 | + | |
105 | + VUNSETATTR (v, att_invisible); | |
106 | return v; | |
107 | } | |
108 | *************** | |
109 | *** 1022,1025 **** | |
110 | --- 1024,1029 ---- | |
111 | if (array_p (v) == 0) | |
112 | v = convert_var_to_array (v); | |
113 | + | |
114 | + VUNSETATTR (v, att_invisible); | |
115 | ||
116 | a = array_cell (v); | |
117 | *** ../bash-3.0/array.c Thu May 6 08:24:13 2004 | |
118 | --- array.c Wed Aug 25 15:50:42 2004 | |
119 | *************** | |
120 | *** 452,456 **** | |
121 | array_dispose_element(new); | |
122 | free(element_value(ae)); | |
123 | ! ae->value = savestring(v); | |
124 | return(0); | |
125 | } else if (element_index(ae) > i) { | |
126 | --- 454,458 ---- | |
127 | array_dispose_element(new); | |
128 | free(element_value(ae)); | |
129 | ! ae->value = v ? savestring(v) : (char *)NULL; | |
130 | return(0); | |
131 | } else if (element_index(ae) > i) { | |
132 | ||
133 | *** ../bash-3.0/patchlevel.h Wed Aug 22 08:05:39 2001 | |
134 | --- patchlevel.h Thu Sep 2 15:04:32 2004 | |
135 | *************** | |
136 | *** 26,30 **** | |
137 | looks for to find the patch level (for the sccs version string). */ | |
138 | ||
139 | ! #define PATCHLEVEL 0 | |
140 | ||
141 | #endif /* _PATCHLEVEL_H_ */ | |
142 | --- 26,30 ---- | |
143 | looks for to find the patch level (for the sccs version string). */ | |
144 | ||
145 | ! #define PATCHLEVEL 1 | |
146 | ||
147 | #endif /* _PATCHLEVEL_H_ */ | |
148 | *** ../bash-3.0/tests/dbg-support.tests Tue Mar 25 15:33:03 2003 | |
149 | --- tests/dbg-support.tests Tue Aug 3 23:09:29 2004 | |
150 | *************** | |
151 | *** 63,68 **** | |
152 | trap 'print_return_trap $LINENO' RETURN | |
153 | ||
154 | ! # Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array. | |
155 | ! echo "FUNCNAME" ${FUNCNAME[0]} | |
156 | ||
157 | # We should trace into the below. | |
158 | --- 63,68 ---- | |
159 | trap 'print_return_trap $LINENO' RETURN | |
160 | ||
161 | ! # Funcname is now an array, but you still can't see it outside a function | |
162 | ! echo "FUNCNAME" ${FUNCNAME[0]:-main} | |
163 | ||
164 | # We should trace into the below. |