openpkg/bash.patch

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 13
cb59d6afeb61
child 428
f880f219c566
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

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

mercurial