diff options
Diffstat (limited to 'meta/packages')
-rw-r--r-- | meta/packages/bash/bash-3.2/001-005.patch | 312 | ||||
-rw-r--r-- | meta/packages/bash/bash_3.2.bb | 28 |
2 files changed, 340 insertions, 0 deletions
diff --git a/meta/packages/bash/bash-3.2/001-005.patch b/meta/packages/bash/bash-3.2/001-005.patch new file mode 100644 index 0000000000..541d71385f --- /dev/null +++ b/meta/packages/bash/bash-3.2/001-005.patch | |||
@@ -0,0 +1,312 @@ | |||
1 | |||
2 | Collected upstream patches: 001 -> 005 | ||
3 | |||
4 | Index: bash-3.2/parse.y | ||
5 | =================================================================== | ||
6 | --- bash-3.2.orig/parse.y 2006-11-27 20:09:18.000000000 +0100 | ||
7 | +++ bash-3.2/parse.y 2006-11-27 20:10:10.000000000 +0100 | ||
8 | @@ -1029,6 +1029,7 @@ | ||
9 | #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ | ||
10 | #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ | ||
11 | #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ | ||
12 | +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ | ||
13 | |||
14 | /* Initial size to allocate for tokens, and the | ||
15 | amount to grow them by. */ | ||
16 | @@ -2591,6 +2592,9 @@ | ||
17 | return (character); | ||
18 | } | ||
19 | |||
20 | + if (parser_state & PST_REGEXP) | ||
21 | + goto tokword; | ||
22 | + | ||
23 | /* Shell meta-characters. */ | ||
24 | if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) | ||
25 | { | ||
26 | @@ -2698,6 +2702,7 @@ | ||
27 | if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) | ||
28 | return (character); | ||
29 | |||
30 | +tokword: | ||
31 | /* Okay, if we got this far, we have to read a word. Read one, | ||
32 | and then check it against the known ones. */ | ||
33 | result = read_token_word (character); | ||
34 | @@ -2735,7 +2740,7 @@ | ||
35 | /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ | ||
36 | count = 1; | ||
37 | pass_next_character = backq_backslash = was_dollar = in_comment = 0; | ||
38 | - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; | ||
39 | + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; | ||
40 | |||
41 | /* RFLAGS is the set of flags we want to pass to recursive calls. */ | ||
42 | rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); | ||
43 | @@ -3202,8 +3207,11 @@ | ||
44 | if (tok == WORD && test_binop (yylval.word->word)) | ||
45 | op = yylval.word; | ||
46 | #if defined (COND_REGEXP) | ||
47 | - else if (tok == WORD && STREQ (yylval.word->word,"=~")) | ||
48 | - op = yylval.word; | ||
49 | + else if (tok == WORD && STREQ (yylval.word->word, "=~")) | ||
50 | + { | ||
51 | + op = yylval.word; | ||
52 | + parser_state |= PST_REGEXP; | ||
53 | + } | ||
54 | #endif | ||
55 | else if (tok == '<' || tok == '>') | ||
56 | op = make_word_from_token (tok); /* ( */ | ||
57 | @@ -3234,6 +3242,7 @@ | ||
58 | |||
59 | /* rhs */ | ||
60 | tok = read_token (READ); | ||
61 | + parser_state &= ~PST_REGEXP; | ||
62 | if (tok == WORD) | ||
63 | { | ||
64 | tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); | ||
65 | @@ -3419,9 +3428,34 @@ | ||
66 | goto next_character; | ||
67 | } | ||
68 | |||
69 | +#ifdef COND_REGEXP | ||
70 | + /* When parsing a regexp as a single word inside a conditional command, | ||
71 | + we need to special-case characters special to both the shell and | ||
72 | + regular expressions. Right now, that is only '(' and '|'. */ /*)*/ | ||
73 | + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/ | ||
74 | + { | ||
75 | + if (character == '|') | ||
76 | + goto got_character; | ||
77 | + | ||
78 | + push_delimiter (dstack, character); | ||
79 | + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0); | ||
80 | + pop_delimiter (dstack); | ||
81 | + if (ttok == &matched_pair_error) | ||
82 | + return -1; /* Bail immediately. */ | ||
83 | + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2, | ||
84 | + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE); | ||
85 | + token[token_index++] = character; | ||
86 | + strcpy (token + token_index, ttok); | ||
87 | + token_index += ttoklen; | ||
88 | + FREE (ttok); | ||
89 | + dollar_present = all_digit_token = 0; | ||
90 | + goto next_character; | ||
91 | + } | ||
92 | +#endif /* COND_REGEXP */ | ||
93 | + | ||
94 | #ifdef EXTENDED_GLOB | ||
95 | /* Parse a ksh-style extended pattern matching specification. */ | ||
96 | - if (extended_glob && PATTERN_CHAR (character)) | ||
97 | + if MBTEST(extended_glob && PATTERN_CHAR (character)) | ||
98 | { | ||
99 | peek_char = shell_getc (1); | ||
100 | if MBTEST(peek_char == '(') /* ) */ | ||
101 | Index: bash-3.2/patchlevel.h | ||
102 | =================================================================== | ||
103 | --- bash-3.2.orig/patchlevel.h 2006-11-27 20:09:18.000000000 +0100 | ||
104 | +++ bash-3.2/patchlevel.h 2006-11-27 20:11:06.000000000 +0100 | ||
105 | @@ -25,6 +25,6 @@ | ||
106 | regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh | ||
107 | looks for to find the patch level (for the sccs version string). */ | ||
108 | |||
109 | -#define PATCHLEVEL 0 | ||
110 | +#define PATCHLEVEL 5 | ||
111 | |||
112 | #endif /* _PATCHLEVEL_H_ */ | ||
113 | Index: bash-3.2/po/ru.po | ||
114 | =================================================================== | ||
115 | --- bash-3.2.orig/po/ru.po 2006-11-27 20:09:18.000000000 +0100 | ||
116 | +++ bash-3.2/po/ru.po 2006-11-27 20:10:00.000000000 +0100 | ||
117 | @@ -12,7 +12,7 @@ | ||
118 | "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n" | ||
119 | "Language-Team: Russian <ru@li.org>\n" | ||
120 | "MIME-Version: 1.0\n" | ||
121 | -"Content-Type: text/plain; charset=UTF-8\n" | ||
122 | +"Content-Type: text/plain; charset=KOI8-R\n" | ||
123 | "Content-Transfer-Encoding: 8bit\n" | ||
124 | "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" | ||
125 | |||
126 | Index: bash-3.2/subst.c | ||
127 | =================================================================== | ||
128 | --- bash-3.2.orig/subst.c 2006-11-27 20:09:18.000000000 +0100 | ||
129 | +++ bash-3.2/subst.c 2006-11-27 20:10:26.000000000 +0100 | ||
130 | @@ -5707,6 +5707,11 @@ | ||
131 | vtype &= ~VT_STARSUB; | ||
132 | |||
133 | mflags = 0; | ||
134 | + if (patsub && *patsub == '/') | ||
135 | + { | ||
136 | + mflags |= MATCH_GLOBREP; | ||
137 | + patsub++; | ||
138 | + } | ||
139 | |||
140 | /* Malloc this because expand_string_if_necessary or one of the expansion | ||
141 | functions in its call chain may free it on a substitution error. */ | ||
142 | @@ -5741,13 +5746,12 @@ | ||
143 | } | ||
144 | |||
145 | /* ksh93 doesn't allow the match specifier to be a part of the expanded | ||
146 | - pattern. This is an extension. */ | ||
147 | + pattern. This is an extension. Make sure we don't anchor the pattern | ||
148 | + at the beginning or end of the string if we're doing global replacement, | ||
149 | + though. */ | ||
150 | p = pat; | ||
151 | - if (pat && pat[0] == '/') | ||
152 | - { | ||
153 | - mflags |= MATCH_GLOBREP|MATCH_ANY; | ||
154 | - p++; | ||
155 | - } | ||
156 | + if (mflags & MATCH_GLOBREP) | ||
157 | + mflags |= MATCH_ANY; | ||
158 | else if (pat && pat[0] == '#') | ||
159 | { | ||
160 | mflags |= MATCH_BEG; | ||
161 | Index: bash-3.2/tests/new-exp.right | ||
162 | =================================================================== | ||
163 | --- bash-3.2.orig/tests/new-exp.right 2006-11-27 20:09:18.000000000 +0100 | ||
164 | +++ bash-3.2/tests/new-exp.right 2006-11-27 20:10:29.000000000 +0100 | ||
165 | @@ -430,7 +430,7 @@ | ||
166 | Case06---1---A B C::--- | ||
167 | Case07---3---A:B:C--- | ||
168 | Case08---3---A:B:C--- | ||
169 | -./new-exp.tests: line 506: /${$(($#-1))}: bad substitution | ||
170 | +./new-exp.tests: line 506: ${$(($#-1))}: bad substitution | ||
171 | argv[1] = <a> | ||
172 | argv[2] = <b> | ||
173 | argv[3] = <c> | ||
174 | Index: bash-3.2/builtins/printf.def | ||
175 | =================================================================== | ||
176 | --- bash-3.2.orig/builtins/printf.def 2006-11-27 20:09:18.000000000 +0100 | ||
177 | +++ bash-3.2/builtins/printf.def 2006-11-27 20:11:05.000000000 +0100 | ||
178 | @@ -49,6 +49,12 @@ | ||
179 | # define INT_MIN (-2147483647-1) | ||
180 | #endif | ||
181 | |||
182 | +#if defined (PREFER_STDARG) | ||
183 | +# include <stdarg.h> | ||
184 | +#else | ||
185 | +# include <varargs.h> | ||
186 | +#endif | ||
187 | + | ||
188 | #include <stdio.h> | ||
189 | #include <chartypes.h> | ||
190 | |||
191 | @@ -151,6 +157,10 @@ | ||
192 | #define SKIP1 "#'-+ 0" | ||
193 | #define LENMODS "hjlLtz" | ||
194 | |||
195 | +#ifndef HAVE_ASPRINTF | ||
196 | +extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3))); | ||
197 | +#endif | ||
198 | + | ||
199 | static void printf_erange __P((char *)); | ||
200 | static int printstr __P((char *, char *, int, int, int)); | ||
201 | static int tescape __P((char *, char *, int *)); | ||
202 | Index: bash-3.2/lib/sh/snprintf.c | ||
203 | =================================================================== | ||
204 | --- bash-3.2.orig/lib/sh/snprintf.c 2006-11-27 20:09:18.000000000 +0100 | ||
205 | +++ bash-3.2/lib/sh/snprintf.c 2006-11-27 20:11:06.000000000 +0100 | ||
206 | @@ -471,6 +471,8 @@ | ||
207 | 10^x ~= r | ||
208 | * log_10(200) = 2; | ||
209 | * log_10(250) = 2; | ||
210 | + * | ||
211 | + * NOTE: do not call this with r == 0 -- an infinite loop results. | ||
212 | */ | ||
213 | static int | ||
214 | log_10(r) | ||
215 | @@ -576,8 +578,11 @@ | ||
216 | { | ||
217 | integral_part[0] = '0'; | ||
218 | integral_part[1] = '\0'; | ||
219 | - fraction_part[0] = '0'; | ||
220 | - fraction_part[1] = '\0'; | ||
221 | + /* The fractional part has to take the precision into account */ | ||
222 | + for (ch = 0; ch < precision-1; ch++) | ||
223 | + fraction_part[ch] = '0'; | ||
224 | + fraction_part[ch] = '0'; | ||
225 | + fraction_part[ch+1] = '\0'; | ||
226 | if (fract) | ||
227 | *fract = fraction_part; | ||
228 | return integral_part; | ||
229 | @@ -805,6 +810,7 @@ | ||
230 | PUT_CHAR(*tmp, p); | ||
231 | tmp++; | ||
232 | } | ||
233 | + | ||
234 | PAD_LEFT(p); | ||
235 | } | ||
236 | |||
237 | @@ -972,11 +978,21 @@ | ||
238 | if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp))) | ||
239 | tmp = t; | ||
240 | |||
241 | + if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0) | ||
242 | + { | ||
243 | + /* smash the trailing zeros unless altform */ | ||
244 | + for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--) | ||
245 | + tmp2[i] = '\0'; | ||
246 | + if (tmp2[0] == '\0') | ||
247 | + p->precision = 0; | ||
248 | + } | ||
249 | + | ||
250 | /* calculate the padding. 1 for the dot */ | ||
251 | p->width = p->width - | ||
252 | ((d > 0. && p->justify == RIGHT) ? 1:0) - | ||
253 | ((p->flags & PF_SPACE) ? 1:0) - | ||
254 | - strlen(tmp) - p->precision - 1; | ||
255 | + strlen(tmp) - p->precision - | ||
256 | + ((p->precision != 0 || (p->flags & PF_ALTFORM)) ? 1 : 0); /* radix char */ | ||
257 | PAD_RIGHT(p); | ||
258 | PUT_PLUS(d, p, 0.); | ||
259 | PUT_SPACE(d, p, 0.); | ||
260 | @@ -991,11 +1007,6 @@ | ||
261 | if (p->precision != 0 || (p->flags & PF_ALTFORM)) | ||
262 | PUT_CHAR(decpoint, p); /* put the '.' */ | ||
263 | |||
264 | - if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0) | ||
265 | - /* smash the trailing zeros unless altform */ | ||
266 | - for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--) | ||
267 | - tmp2[i] = '\0'; | ||
268 | - | ||
269 | for (; *tmp2; tmp2++) | ||
270 | PUT_CHAR(*tmp2, p); /* the fraction */ | ||
271 | |||
272 | @@ -1011,14 +1022,19 @@ | ||
273 | char *tmp, *tmp2; | ||
274 | int j, i; | ||
275 | |||
276 | - if (chkinfnan(p, d, 1) || chkinfnan(p, d, 2)) | ||
277 | + if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))) | ||
278 | return; /* already printed nan or inf */ | ||
279 | |||
280 | GETLOCALEDATA(decpoint, thoussep, grouping); | ||
281 | DEF_PREC(p); | ||
282 | - j = log_10(d); | ||
283 | - d = d / pow_10(j); /* get the Mantissa */ | ||
284 | - d = ROUND(d, p); | ||
285 | + if (d == 0.) | ||
286 | + j = 0; | ||
287 | + else | ||
288 | + { | ||
289 | + j = log_10(d); | ||
290 | + d = d / pow_10(j); /* get the Mantissa */ | ||
291 | + d = ROUND(d, p); | ||
292 | + } | ||
293 | tmp = dtoa(d, p->precision, &tmp2); | ||
294 | |||
295 | /* 1 for unit, 1 for the '.', 1 for 'e|E', | ||
296 | @@ -1076,6 +1092,7 @@ | ||
297 | PUT_CHAR(*tmp, p); | ||
298 | tmp++; | ||
299 | } | ||
300 | + | ||
301 | PAD_LEFT(p); | ||
302 | } | ||
303 | #endif | ||
304 | @@ -1358,7 +1375,7 @@ | ||
305 | STAR_ARGS(data); | ||
306 | DEF_PREC(data); | ||
307 | d = GETDOUBLE(data); | ||
308 | - i = log_10(d); | ||
309 | + i = (d != 0.) ? log_10(d) : -1; | ||
310 | /* | ||
311 | * for '%g|%G' ANSI: use f if exponent | ||
312 | * is in the range or [-4,p] exclusively | ||
diff --git a/meta/packages/bash/bash_3.2.bb b/meta/packages/bash/bash_3.2.bb new file mode 100644 index 0000000000..e3d6b0560c --- /dev/null +++ b/meta/packages/bash/bash_3.2.bb | |||
@@ -0,0 +1,28 @@ | |||
1 | DESCRIPTION = "An sh-compatible command language interpreter." | ||
2 | HOMEPAGE = "http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html" | ||
3 | DEPENDS = "ncurses" | ||
4 | SECTION = "base/shell" | ||
5 | LICENSE = "GPL" | ||
6 | |||
7 | SRC_URI = "${GNU_MIRROR}/bash/bash-${PV}.tar.gz \ | ||
8 | file://001-005.patch;patch=1" | ||
9 | |||
10 | inherit autotools gettext | ||
11 | |||
12 | PARALLEL_MAKE = "" | ||
13 | |||
14 | bindir = "/bin" | ||
15 | sbindir = "/sbin" | ||
16 | |||
17 | EXTRA_OECONF = "--with-ncurses" | ||
18 | export CC_FOR_BUILD = "${BUILD_CC}" | ||
19 | |||
20 | do_configure () { | ||
21 | gnu-configize | ||
22 | oe_runconf | ||
23 | } | ||
24 | |||
25 | pkg_postinst () { | ||
26 | grep -q "bin/bash" ${sysconfdir}/shells || echo /bin/bash >> ${sysconfdir}/shells | ||
27 | grep -q "bin/sh" ${sysconfdir}/shells || echo /bin/sh >> ${sysconfdir}/shells | ||
28 | } | ||