Tue, 29 Mar 2011 19:46:35 +0200
Correct and introduce slightly needed logic, leading to better reliability:
Update bash(1) patch logic, correct several buildconf make location
errors, correct failed bash(1) configure invocation, enable perl(1) to
build with unpathed make(1), patch rpm(1) to correctly link with
internal libdb(3), and lastly unsuscessfully try to reorganize rpm patch
hunks.
1 This patch documents two implemented and classical command
2 line options "-v" and "-x". It is derived from Debian GNU/Linux.
4 Index: doc/bash.1
5 --- doc/bash.1.orig 2004-07-12 17:27:08 +0200
6 +++ doc/bash.1 2004-07-27 19:47:10 +0200
7 @@ -116,6 +116,12 @@
8 This option allows the positional parameters to be set
9 when invoking an interactive shell.
10 .TP
11 +.B \-v
12 +Print shell input lines as they are read.
13 +.TP
14 +.B \-x
15 +Print commands and their arguments as they are executed.
16 +.TP
17 .B \-D
18 A list of all double-quoted strings preceded by \fB$\fP
19 is printed on the standard output.
21 -----------------------------------------------------------------------------
23 Port to HP-UX 11i and similar less smart platforms.
25 Index: configure
26 --- configure.orig 2004-07-21 22:18:56 +0200
27 +++ configure 2004-07-27 19:47:10 +0200
28 @@ -1517,6 +1517,7 @@
29 *-beos*) opt_bash_malloc=no ;; # they say it's suitable
30 *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
31 *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
32 +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX
33 esac
35 # memory scrambling on free()
36 @@ -1662,7 +1663,7 @@
38 else
39 MALLOC_LIB=
40 - MALLOC_LIBRARY=
41 + MALLOC_LIBRARY=dummy
42 MALLOC_LDFLAGS=
43 MALLOC_DEP=
44 fi
45 Index: syntax.h
46 --- syntax.h.orig 2004-04-15 05:19:36 +0200
47 +++ syntax.h 2004-07-27 19:47:10 +0200
48 @@ -21,6 +21,8 @@
49 #ifndef _SYNTAX_H_
50 #define _SYNTAX_H_
52 +#include "config.h"
53 +
54 /* Defines for use by mksyntax.c */
56 #define slashify_in_quotes "\\`$\"\n"
58 -----------------------------------------------------------------------------
60 This adds the OpenPKG packaging brand.
62 Index: version.c
63 --- version.c.orig 2003-12-19 22:34:02 +0100
64 +++ version.c 2004-07-27 19:47:10 +0200
65 @@ -77,7 +77,7 @@
66 show_shell_version (extended)
67 int extended;
68 {
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);
71 if (extended)
72 printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n"));
73 }
75 -----------------------------------------------------------------------------
77 Accumulated vendor patches Bash 3.2 001-005
79 Generated via:
81 $ gunzip <bash-3.2.tar.gz | tar xf -
82 $ pushd bash-3.2
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
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 */
112 /* Initial size to allocate for tokens, and the
113 amount to grow them by. */
114 @@ -2591,6 +2592,9 @@
115 return (character);
116 }
118 + if (parser_state & PST_REGEXP)
119 + goto tokword;
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);
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;
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 @@
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 }
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). */
206 -#define PATCHLEVEL 0
207 +#define PATCHLEVEL 5
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;
216 mflags = 0;
217 + if (patsub && *patsub == '/')
218 + {
219 + mflags |= MATCH_GLOBREP;
220 + patsub++;
221 + }
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 }
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 */
253 /* Initial size to allocate for tokens, and the
254 amount to grow them by. */
255 @@ -3921,6 +3922,9 @@
256 return (character);
257 }
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);
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;
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 @@
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 }
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 == '(') /* ) */
341 -----------------------------------------------------------------------------
343 Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64
345 Index: Makefile.in
346 --- Makefile.in.orig 2006-08-17 20:03:35 +0200
347 +++ Makefile.in 2007-10-15 13:00:34 +0200
348 @@ -682,13 +682,9 @@
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
352 -config.status: $(srcdir)/configure
353 +config.status:
354 $(SHELL) ./config.status --recheck
356 -# comment out for distribution
357 -$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
358 - cd $(srcdir) && autoconf
359 -
360 # for chet
361 reconfig: force
362 sh $(srcdir)/configure -C