openpkg/bash.patch

changeset 428
f880f219c566
parent 333
4ecfc2416fd8
child 570
d7167d2b16f4
equal deleted inserted replaced
1:fd5c9e3431fa 2:e1d4c5ee930a
1 This patch documents two implemented and classical command 1 This patch documents two implemented and classical command
2 line options "-v" and "-x". It is derived from Debian GNU/Linux. 2 line options "-v" and "-x". It is derived from Debian GNU/Linux.
3 3
4 Index: doc/bash.1 4 Index: doc/bash.1
5 --- doc/bash.1.orig 2004-07-12 17:27:08 +0200 5 --- doc/bash.1.orig 2011-01-16 21:31:39.000000000 +0100
6 +++ doc/bash.1 2004-07-27 19:47:10 +0200 6 +++ doc/bash.1 2011-02-21 18:56:01.000000000 +0100
7 @@ -116,6 +116,12 @@ 7 @@ -117,6 +117,12 @@
8 This option allows the positional parameters to be set 8 This option allows the positional parameters to be set
9 when invoking an interactive shell. 9 when invoking an interactive shell.
10 .TP 10 .TP
11 +.B \-v 11 +.B \-v
12 +Print shell input lines as they are read. 12 +Print shell input lines as they are read.
21 ----------------------------------------------------------------------------- 21 -----------------------------------------------------------------------------
22 22
23 Port to HP-UX 11i and similar less smart platforms. 23 Port to HP-UX 11i and similar less smart platforms.
24 24
25 Index: configure 25 Index: configure
26 --- configure.orig 2004-07-21 22:18:56 +0200 26 --- configure.orig 2011-02-07 23:03:22.000000000 +0100
27 +++ configure 2004-07-27 19:47:10 +0200 27 +++ configure 2011-02-21 18:56:01.000000000 +0100
28 @@ -1517,6 +1517,7 @@ 28 @@ -2202,6 +2202,7 @@
29 *-beos*) opt_bash_malloc=no ;; # they say it's suitable 29 *-beos*) opt_bash_malloc=no ;; # they say it's suitable
30 *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment 30 *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
31 *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft 31 *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
32 +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX 32 +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX
33 esac 33 esac
34 34
35 # memory scrambling on free() 35 # memory scrambling on free()
36 @@ -1662,7 +1663,7 @@ 36 @@ -2270,7 +2271,7 @@
37 37
38 else 38 else
39 MALLOC_LIB= 39 MALLOC_LIB=
40 - MALLOC_LIBRARY= 40 - MALLOC_LIBRARY=
41 + MALLOC_LIBRARY=dummy 41 + MALLOC_LIBRARY=dummy
42 MALLOC_LDFLAGS= 42 MALLOC_LDFLAGS=
43 MALLOC_DEP= 43 MALLOC_DEP=
44 fi 44 fi
45 Index: syntax.h 45 Index: syntax.h
46 --- syntax.h.orig 2004-04-15 05:19:36 +0200 46 --- syntax.h.orig 2009-01-04 20:32:42.000000000 +0100
47 +++ syntax.h 2004-07-27 19:47:10 +0200 47 +++ syntax.h 2011-02-21 18:56:01.000000000 +0100
48 @@ -21,6 +21,8 @@ 48 @@ -21,6 +21,8 @@
49 #ifndef _SYNTAX_H_ 49 #ifndef _SYNTAX_H_
50 #define _SYNTAX_H_ 50 #define _SYNTAX_H_
51 51
52 +#include "config.h" 52 +#include "config.h"
58 ----------------------------------------------------------------------------- 58 -----------------------------------------------------------------------------
59 59
60 This adds the OpenPKG packaging brand. 60 This adds the OpenPKG packaging brand.
61 61
62 Index: version.c 62 Index: version.c
63 --- version.c.orig 2003-12-19 22:34:02 +0100 63 --- version.c.orig 2011-01-28 17:32:36.000000000 +0100
64 +++ version.c 2004-07-27 19:47:10 +0200 64 +++ version.c 2011-02-21 18:56:01.000000000 +0100
65 @@ -77,7 +77,7 @@ 65 @@ -83,7 +83,7 @@
66 show_shell_version (extended) 66 show_shell_version (extended)
67 int extended; 67 int extended;
68 { 68 {
69 - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); 69 - printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE);
70 + printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE); 70 + printf (_("GNU bash, version %s (%s) [@l_openpkg_release@]\n"), shell_version_string (), MACHTYPE);
71 if (extended) 71 if (extended)
72 printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n")); 72 {
73 } 73 printf ("%s\n", _(bash_copyright));
74 74
75 ----------------------------------------------------------------------------- 75 -----------------------------------------------------------------------------
76 76
77 Accumulated vendor patches Bash 3.2 001-005 77 Ensure that Autoconf and friends are not run.
78 78
79 Generated via: 79 Index: Makefile.in
80 80 --- Makefile.in.orig 2010-12-01 01:22:42.000000000 +0100
81 $ gunzip <bash-3.2.tar.gz | tar xf - 81 +++ Makefile.in 2011-02-21 18:56:01.000000000 +0100
82 $ pushd bash-3.2 82 @@ -711,7 +711,6 @@
83 $ cat bash32-[0-9]* | patch -p0 -Vt -b
84 $ shtool move -e '*.~1~' '%1.orig'
85 $ pushd /tmp
86 $ curl -O ftp://ftp.gnu.org/gnu/bison/bison-1.28.tar.gz
87 $ cd bison-1.28
88 $ ./configure --prefix=/tmp/bison
89 $ make
90 $ make install
91 $ popd
92 $ mv y.tab.c y.tab.c.orig
93 $ mv y.tab.h y.tab.h.orig
94 $ /tmp/bison/bin/bison -y -d parse.y
95 $ rm -rf /tmp/bison /tmp/bison-1.28 /tmp/bison-1.28.tar.gz
96 $ shtool subst -b.dummy \
97 -e 's;parse\.y;/Users/chet/src/bash/src/parse.y;g' \
98 -e 's;/tmp/bison/share/bison\.simple;/usr/share/bison.simple;g' y.tab.c
99 $ svs diff >/tmp/bash.patch
100 $ popd
101 $ rm -rf bash-3.2
102
103 Index: parse.y
104 --- parse.y.orig 2006-09-19 22:37:21 +0200
105 +++ parse.y 2006-12-06 13:32:45 +0100
106 @@ -1029,6 +1029,7 @@
107 #define PST_CMDTOKEN 0x1000 /* command token OK - unused */
108 #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */
109 #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */
110 +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */
111 83
112 /* Initial size to allocate for tokens, and the 84 # comment out for distribution
113 amount to grow them by. */ 85 $(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
114 @@ -2591,6 +2592,9 @@ 86 - cd $(srcdir) && autoconf
115 return (character);
116 }
117 87
118 + if (parser_state & PST_REGEXP) 88 # for chet
119 + goto tokword; 89 reconfig: force
120 +
121 /* Shell meta-characters. */
122 if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
123 {
124 @@ -2698,6 +2702,7 @@
125 if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
126 return (character);
127
128 +tokword:
129 /* Okay, if we got this far, we have to read a word. Read one,
130 and then check it against the known ones. */
131 result = read_token_word (character);
132 @@ -2735,7 +2740,7 @@
133 /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
134 count = 1;
135 pass_next_character = backq_backslash = was_dollar = in_comment = 0;
136 - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
137 + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
138
139 /* RFLAGS is the set of flags we want to pass to recursive calls. */
140 rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
141 @@ -3202,8 +3207,11 @@
142 if (tok == WORD && test_binop (yylval.word->word))
143 op = yylval.word;
144 #if defined (COND_REGEXP)
145 - else if (tok == WORD && STREQ (yylval.word->word,"=~"))
146 - op = yylval.word;
147 + else if (tok == WORD && STREQ (yylval.word->word, "=~"))
148 + {
149 + op = yylval.word;
150 + parser_state |= PST_REGEXP;
151 + }
152 #endif
153 else if (tok == '<' || tok == '>')
154 op = make_word_from_token (tok); /* ( */
155 @@ -3234,6 +3242,7 @@
156
157 /* rhs */
158 tok = read_token (READ);
159 + parser_state &= ~PST_REGEXP;
160 if (tok == WORD)
161 {
162 tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
163 @@ -3419,9 +3428,34 @@
164 goto next_character;
165 }
166
167 +#ifdef COND_REGEXP
168 + /* When parsing a regexp as a single word inside a conditional command,
169 + we need to special-case characters special to both the shell and
170 + regular expressions. Right now, that is only '(' and '|'. */ /*)*/
171 + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/
172 + {
173 + if (character == '|')
174 + goto got_character;
175 +
176 + push_delimiter (dstack, character);
177 + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
178 + pop_delimiter (dstack);
179 + if (ttok == &matched_pair_error)
180 + return -1; /* Bail immediately. */
181 + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
182 + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
183 + token[token_index++] = character;
184 + strcpy (token + token_index, ttok);
185 + token_index += ttoklen;
186 + FREE (ttok);
187 + dollar_present = all_digit_token = 0;
188 + goto next_character;
189 + }
190 +#endif /* COND_REGEXP */
191 +
192 #ifdef EXTENDED_GLOB
193 /* Parse a ksh-style extended pattern matching specification. */
194 - if (extended_glob && PATTERN_CHAR (character))
195 + if MBTEST(extended_glob && PATTERN_CHAR (character))
196 {
197 peek_char = shell_getc (1);
198 if MBTEST(peek_char == '(') /* ) */
199 Index: patchlevel.h
200 --- patchlevel.h.orig 2006-04-13 14:31:04 +0200
201 +++ patchlevel.h 2006-12-06 13:32:45 +0100
202 @@ -25,6 +25,6 @@
203 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
204 looks for to find the patch level (for the sccs version string). */
205
206 -#define PATCHLEVEL 0
207 +#define PATCHLEVEL 5
208
209 #endif /* _PATCHLEVEL_H_ */
210 Index: subst.c
211 --- subst.c.orig 2006-09-19 14:35:09 +0200
212 +++ subst.c 2006-12-06 13:32:45 +0100
213 @@ -5707,6 +5707,11 @@
214 vtype &= ~VT_STARSUB;
215
216 mflags = 0;
217 + if (patsub && *patsub == '/')
218 + {
219 + mflags |= MATCH_GLOBREP;
220 + patsub++;
221 + }
222
223 /* Malloc this because expand_string_if_necessary or one of the expansion
224 functions in its call chain may free it on a substitution error. */
225 @@ -5741,13 +5746,12 @@
226 }
227
228 /* ksh93 doesn't allow the match specifier to be a part of the expanded
229 - pattern. This is an extension. */
230 + pattern. This is an extension. Make sure we don't anchor the pattern
231 + at the beginning or end of the string if we're doing global replacement,
232 + though. */
233 p = pat;
234 - if (pat && pat[0] == '/')
235 - {
236 - mflags |= MATCH_GLOBREP|MATCH_ANY;
237 - p++;
238 - }
239 + if (mflags & MATCH_GLOBREP)
240 + mflags |= MATCH_ANY;
241 else if (pat && pat[0] == '#')
242 {
243 mflags |= MATCH_BEG;
244 Index: y.tab.c
245 --- y.tab.c.orig 2006-09-25 14:15:16 +0200
246 +++ y.tab.c 2006-12-06 13:39:36 +0100
247 @@ -2359,6 +2359,7 @@
248 #define PST_CMDTOKEN 0x1000 /* command token OK - unused */
249 #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */
250 #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */
251 +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */
252
253 /* Initial size to allocate for tokens, and the
254 amount to grow them by. */
255 @@ -3921,6 +3922,9 @@
256 return (character);
257 }
258
259 + if (parser_state & PST_REGEXP)
260 + goto tokword;
261 +
262 /* Shell meta-characters. */
263 if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
264 {
265 @@ -4028,6 +4032,7 @@
266 if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
267 return (character);
268
269 +tokword:
270 /* Okay, if we got this far, we have to read a word. Read one,
271 and then check it against the known ones. */
272 result = read_token_word (character);
273 @@ -4065,7 +4070,7 @@
274 /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
275 count = 1;
276 pass_next_character = backq_backslash = was_dollar = in_comment = 0;
277 - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
278 + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
279
280 /* RFLAGS is the set of flags we want to pass to recursive calls. */
281 rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
282 @@ -4532,8 +4537,11 @@
283 if (tok == WORD && test_binop (yylval.word->word))
284 op = yylval.word;
285 #if defined (COND_REGEXP)
286 - else if (tok == WORD && STREQ (yylval.word->word,"=~"))
287 - op = yylval.word;
288 + else if (tok == WORD && STREQ (yylval.word->word, "=~"))
289 + {
290 + op = yylval.word;
291 + parser_state |= PST_REGEXP;
292 + }
293 #endif
294 else if (tok == '<' || tok == '>')
295 op = make_word_from_token (tok); /* ( */
296 @@ -4564,6 +4572,7 @@
297
298 /* rhs */
299 tok = read_token (READ);
300 + parser_state &= ~PST_REGEXP;
301 if (tok == WORD)
302 {
303 tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
304 @@ -4749,9 +4758,34 @@
305 goto next_character;
306 }
307
308 +#ifdef COND_REGEXP
309 + /* When parsing a regexp as a single word inside a conditional command,
310 + we need to special-case characters special to both the shell and
311 + regular expressions. Right now, that is only '(' and '|'. */ /*)*/
312 + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/
313 + {
314 + if (character == '|')
315 + goto got_character;
316 +
317 + push_delimiter (dstack, character);
318 + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
319 + pop_delimiter (dstack);
320 + if (ttok == &matched_pair_error)
321 + return -1; /* Bail immediately. */
322 + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
323 + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
324 + token[token_index++] = character;
325 + strcpy (token + token_index, ttok);
326 + token_index += ttoklen;
327 + FREE (ttok);
328 + dollar_present = all_digit_token = 0;
329 + goto next_character;
330 + }
331 +#endif /* COND_REGEXP */
332 +
333 #ifdef EXTENDED_GLOB
334 /* Parse a ksh-style extended pattern matching specification. */
335 - if (extended_glob && PATTERN_CHAR (character))
336 + if MBTEST(extended_glob && PATTERN_CHAR (character))
337 {
338 peek_char = shell_getc (1);
339 if MBTEST(peek_char == '(') /* ) */
340 90
341 ----------------------------------------------------------------------------- 91 -----------------------------------------------------------------------------
342 92
343 Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64 93 Fix Bash getcwd(3) run-time issue seen on Solaris where size argument
94 of 0 does not malloc buffer as expected by Bash code.
344 95
345 Index: Makefile.in 96 Index: builtins/common.c
346 --- Makefile.in.orig 2006-08-17 20:03:35 +0200 97 --- builtins/common.c.orig 2011-01-05 23:51:26.000000000 +0100
347 +++ Makefile.in 2007-10-15 13:00:34 +0200 98 +++ builtins/common.c 2011-02-21 18:56:01.000000000 +0100
348 @@ -682,13 +682,9 @@ 99 @@ -553,10 +553,11 @@
349 stamp-h: config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
350 CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
351 100
352 -config.status: $(srcdir)/configure 101 if (the_current_working_directory == 0)
353 +config.status: 102 {
354 $(SHELL) ./config.status --recheck 103 + char *t = xmalloc(PATH_MAX);
104 #if defined (GETCWD_BROKEN)
105 - the_current_working_directory = getcwd (0, PATH_MAX);
106 + the_current_working_directory = getcwd (t, PATH_MAX);
107 #else
108 - the_current_working_directory = getcwd (0, 0);
109 + the_current_working_directory = getcwd (t, PATH_MAX);
110 #endif
111 if (the_current_working_directory == 0)
112 {
113
114 -----------------------------------------------------------------------------
115
116 Fix building under Linux.
117
118 Index: externs.h
119 --- externs.h.orig 2010-11-30 02:59:20.000000000 +0100
120 +++ externs.h 2011-02-21 18:56:01.000000000 +0100
121 @@ -25,6 +25,7 @@
122 # define _EXTERNS_H_
355 123
356 -# comment out for distribution 124 #include "stdc.h"
357 -$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in 125 +#include <stdio.h>
358 - cd $(srcdir) && autoconf 126
359 - 127 /* Functions from expr.c. */
360 # for chet 128 extern intmax_t evalexp __P((char *, int *));
361 reconfig: force 129
362 sh $(srcdir)/configure -C

mercurial