]>
Commit | Line | Data |
---|---|---|
a8c304fb ER |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 3.1 | |
5 | Patch-ID: bash31-017 | |
6 | ||
7 | Bug-Reported-by: syphir@syphir.sytes.net | |
8 | Bug-Reference-ID: <442421F5.3010105@syphir.sytes.net> | |
9 | Bug-Reference-URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=358831 | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | Array expansion fails with an arithmetic syntax error when the subscript | |
14 | appears within double quotes. For example: ${a["4"]}. | |
15 | ||
16 | Patch: | |
17 | ||
18 | *** ../bash-3.1-patched/subst.c Wed Apr 12 08:47:08 2006 | |
19 | --- subst.c Wed Apr 12 08:49:02 2006 | |
20 | *************** | |
21 | *** 2576,2579 **** | |
22 | --- 2576,2586 ---- | |
23 | } | |
24 | ||
25 | + char * | |
26 | + expand_arith_string (string, quoted) | |
27 | + char *string; | |
28 | + { | |
29 | + return (expand_string_if_necessary (string, quoted, expand_string)); | |
30 | + } | |
31 | + | |
32 | #if defined (COND_COMMAND) | |
33 | /* Just remove backslashes in STRING. Returns a new string. */ | |
34 | *************** | |
35 | *** 5249,5253 **** | |
36 | t = (char *)0; | |
37 | ||
38 | ! temp1 = expand_string_if_necessary (substr, Q_DOUBLE_QUOTES, expand_string); | |
39 | *e1p = evalexp (temp1, &expok); | |
40 | free (temp1); | |
41 | --- 5256,5260 ---- | |
42 | t = (char *)0; | |
43 | ||
44 | ! temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES); | |
45 | *e1p = evalexp (temp1, &expok); | |
46 | free (temp1); | |
47 | *************** | |
48 | *** 5294,5298 **** | |
49 | t++; | |
50 | temp2 = savestring (t); | |
51 | ! temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); | |
52 | free (temp2); | |
53 | t[-1] = ':'; | |
54 | --- 5301,5305 ---- | |
55 | t++; | |
56 | temp2 = savestring (t); | |
57 | ! temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); | |
58 | free (temp2); | |
59 | t[-1] = ':'; | |
60 | *************** | |
61 | *** 6436,6440 **** | |
62 | ||
63 | /* Expand variables found inside the expression. */ | |
64 | ! temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); | |
65 | free (temp2); | |
66 | ||
67 | --- 6443,6447 ---- | |
68 | ||
69 | /* Expand variables found inside the expression. */ | |
70 | ! temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); | |
71 | free (temp2); | |
72 | ||
73 | *************** | |
74 | *** 6478,6482 **** | |
75 | ||
76 | /* Do initial variable expansion. */ | |
77 | ! temp1 = expand_string_if_necessary (temp, Q_DOUBLE_QUOTES, expand_string); | |
78 | ||
79 | goto arithsub; | |
80 | --- 6485,6489 ---- | |
81 | ||
82 | /* Do initial variable expansion. */ | |
83 | ! temp1 = expand_arith_string (temp, Q_DOUBLE_QUOTES); | |
84 | ||
85 | goto arithsub; | |
86 | *** ../bash-3.1-patched/subst.h Sun Nov 7 15:12:28 2004 | |
87 | --- subst.h Mon Mar 27 09:10:38 2006 | |
88 | *************** | |
89 | *** 152,155 **** | |
90 | --- 152,158 ---- | |
91 | extern char *expand_assignment_string_to_string __P((char *, int)); | |
92 | ||
93 | + /* Expand an arithmetic expression string */ | |
94 | + extern char *expand_arith_string __P((char *, int)); | |
95 | + | |
96 | /* De-quoted quoted characters in STRING. */ | |
97 | extern char *dequote_string __P((char *)); | |
98 | *** ../bash-3.1-patched/arrayfunc.c Mon Jul 4 20:25:58 2005 | |
99 | --- arrayfunc.c Mon Mar 27 09:10:47 2006 | |
100 | *************** | |
101 | *** 593,601 **** | |
102 | strncpy (exp, s, len - 1); | |
103 | exp[len - 1] = '\0'; | |
104 | ! #if 0 | |
105 | ! t = expand_string_to_string (exp, 0); | |
106 | ! #else | |
107 | ! t = expand_string_to_string (exp, Q_DOUBLE_QUOTES); | |
108 | ! #endif | |
109 | this_command_name = (char *)NULL; | |
110 | val = evalexp (t, &expok); | |
111 | --- 591,595 ---- | |
112 | strncpy (exp, s, len - 1); | |
113 | exp[len - 1] = '\0'; | |
114 | ! t = expand_arith_string (exp, 0); | |
115 | this_command_name = (char *)NULL; | |
116 | val = evalexp (t, &expok); | |
117 | *** ../bash-3.1/patchlevel.h Wed Jul 20 13:58:20 2005 | |
118 | --- patchlevel.h Wed Dec 7 13:48:42 2005 | |
119 | *************** | |
120 | *** 26,30 **** | |
121 | looks for to find the patch level (for the sccs version string). */ | |
122 | ||
123 | ! #define PATCHLEVEL 16 | |
124 | ||
125 | #endif /* _PATCHLEVEL_H_ */ | |
126 | --- 26,30 ---- | |
127 | looks for to find the patch level (for the sccs version string). */ | |
128 | ||
129 | ! #define PATCHLEVEL 17 | |
130 | ||
131 | #endif /* _PATCHLEVEL_H_ */ |