openpkg/bash.patch

changeset 13
cb59d6afeb61
child 333
4ecfc2416fd8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/bash.patch	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,362 @@
     1.4 +This patch documents two implemented and classical command
     1.5 +line options "-v" and "-x". It is derived from Debian GNU/Linux.
     1.6 +
     1.7 +Index: doc/bash.1
     1.8 +--- doc/bash.1.orig	2004-07-12 17:27:08 +0200
     1.9 ++++ doc/bash.1	2004-07-27 19:47:10 +0200
    1.10 +@@ -116,6 +116,12 @@
    1.11 + This option allows the positional parameters to be set
    1.12 + when invoking an interactive shell.
    1.13 + .TP
    1.14 ++.B \-v
    1.15 ++Print shell input lines as they are read.
    1.16 ++.TP
    1.17 ++.B \-x
    1.18 ++Print commands and their arguments as they are executed.
    1.19 ++.TP
    1.20 + .B \-D
    1.21 + A list of all double-quoted strings preceded by \fB$\fP
    1.22 + is printed on the standard ouput.
    1.23 +
    1.24 +-----------------------------------------------------------------------------
    1.25 +
    1.26 +Port to HP-UX 11i and similar less smart platforms.
    1.27 +
    1.28 +Index: configure
    1.29 +--- configure.orig	2004-07-21 22:18:56 +0200
    1.30 ++++ configure	2004-07-27 19:47:10 +0200
    1.31 +@@ -1517,6 +1517,7 @@
    1.32 + *-beos*)	opt_bash_malloc=no ;;	# they say it's suitable
    1.33 + *-cygwin*)	opt_bash_malloc=no ;;	# Cygnus's CYGWIN environment
    1.34 + *-opennt*|*-interix*)	opt_bash_malloc=no ;;	# Interix, now owned by Microsoft
    1.35 ++*-hpux*)	opt_bash_malloc=no ;;	# HP HP-UX
    1.36 + esac
    1.37 + 
    1.38 + # memory scrambling on free()
    1.39 +@@ -1662,7 +1663,7 @@
    1.40 + 
    1.41 + else
    1.42 + 	MALLOC_LIB=
    1.43 +-	MALLOC_LIBRARY=
    1.44 ++	MALLOC_LIBRARY=dummy
    1.45 + 	MALLOC_LDFLAGS=
    1.46 + 	MALLOC_DEP=
    1.47 + fi
    1.48 +Index: syntax.h
    1.49 +--- syntax.h.orig	2004-04-15 05:19:36 +0200
    1.50 ++++ syntax.h	2004-07-27 19:47:10 +0200
    1.51 +@@ -21,6 +21,8 @@
    1.52 + #ifndef _SYNTAX_H_
    1.53 + #define _SYNTAX_H_
    1.54 + 
    1.55 ++#include "config.h"
    1.56 ++
    1.57 + /* Defines for use by mksyntax.c */
    1.58 + 
    1.59 + #define slashify_in_quotes "\\`$\"\n"
    1.60 +
    1.61 +-----------------------------------------------------------------------------
    1.62 +
    1.63 +This adds the OpenPKG packaging brand.
    1.64 +
    1.65 +Index: version.c
    1.66 +--- version.c.orig	2003-12-19 22:34:02 +0100
    1.67 ++++ version.c	2004-07-27 19:47:10 +0200
    1.68 +@@ -77,7 +77,7 @@
    1.69 + show_shell_version (extended)
    1.70 +      int extended;
    1.71 + {
    1.72 +-  printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
    1.73 ++  printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE);
    1.74 +   if (extended)
    1.75 +     printf (_("Copyright (C) 2004 Free Software Foundation, Inc.\n"));
    1.76 + }
    1.77 +
    1.78 +-----------------------------------------------------------------------------
    1.79 +
    1.80 +Accumulated vendor patches Bash 3.2 001-005
    1.81 +
    1.82 +Generated via:
    1.83 +
    1.84 +$ gunzip <bash-3.2.tar.gz | tar xf -
    1.85 +$ pushd bash-3.2
    1.86 +$ cat bash32-[0-9]* | patch -p0 -Vt -b
    1.87 +$ shtool move -e '*.~1~' '%1.orig'
    1.88 +$ pushd /tmp
    1.89 +$ curl -O ftp://ftp.gnu.org/gnu/bison/bison-1.28.tar.gz
    1.90 +$ cd bison-1.28
    1.91 +$ ./configure --prefix=/tmp/bison
    1.92 +$ make
    1.93 +$ make install
    1.94 +$ popd
    1.95 +$ mv y.tab.c y.tab.c.orig
    1.96 +$ mv y.tab.h y.tab.h.orig
    1.97 +$ /tmp/bison/bin/bison -y -d parse.y
    1.98 +$ rm -rf /tmp/bison /tmp/bison-1.28 /tmp/bison-1.28.tar.gz
    1.99 +$ shtool subst -b.dummy \
   1.100 +  -e 's;parse\.y;/Users/chet/src/bash/src/parse.y;g' \
   1.101 +  -e 's;/tmp/bison/share/bison\.simple;/usr/share/bison.simple;g' y.tab.c
   1.102 +$ svs diff >/tmp/bash.patch
   1.103 +$ popd
   1.104 +$ rm -rf bash-3.2
   1.105 +
   1.106 +Index: parse.y
   1.107 +--- parse.y.orig	2006-09-19 22:37:21 +0200
   1.108 ++++ parse.y	2006-12-06 13:32:45 +0100
   1.109 +@@ -1029,6 +1029,7 @@
   1.110 + #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
   1.111 + #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
   1.112 + #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
   1.113 ++#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
   1.114 + 
   1.115 + /* Initial size to allocate for tokens, and the
   1.116 +    amount to grow them by. */
   1.117 +@@ -2591,6 +2592,9 @@
   1.118 +       return (character);
   1.119 +     }
   1.120 + 
   1.121 ++  if (parser_state & PST_REGEXP)
   1.122 ++    goto tokword;
   1.123 ++
   1.124 +   /* Shell meta-characters. */
   1.125 +   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
   1.126 +     {
   1.127 +@@ -2698,6 +2702,7 @@
   1.128 +   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
   1.129 +     return (character);
   1.130 + 
   1.131 ++tokword:
   1.132 +   /* Okay, if we got this far, we have to read a word.  Read one,
   1.133 +      and then check it against the known ones. */
   1.134 +   result = read_token_word (character);
   1.135 +@@ -2735,7 +2740,7 @@
   1.136 + /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
   1.137 +   count = 1;
   1.138 +   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
   1.139 +-  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   1.140 ++  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   1.141 + 
   1.142 +   /* RFLAGS is the set of flags we want to pass to recursive calls. */
   1.143 +   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
   1.144 +@@ -3202,8 +3207,11 @@
   1.145 +       if (tok == WORD && test_binop (yylval.word->word))
   1.146 + 	op = yylval.word;
   1.147 + #if defined (COND_REGEXP)
   1.148 +-      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
   1.149 +-	op = yylval.word;
   1.150 ++      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
   1.151 ++	{
   1.152 ++	  op = yylval.word;
   1.153 ++	  parser_state |= PST_REGEXP;
   1.154 ++	}
   1.155 + #endif
   1.156 +       else if (tok == '<' || tok == '>')
   1.157 + 	op = make_word_from_token (tok);  /* ( */
   1.158 +@@ -3234,6 +3242,7 @@
   1.159 + 
   1.160 +       /* rhs */
   1.161 +       tok = read_token (READ);
   1.162 ++      parser_state &= ~PST_REGEXP;
   1.163 +       if (tok == WORD)
   1.164 + 	{
   1.165 + 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
   1.166 +@@ -3419,9 +3428,34 @@
   1.167 + 	  goto next_character;
   1.168 + 	}
   1.169 + 
   1.170 ++#ifdef COND_REGEXP
   1.171 ++      /* When parsing a regexp as a single word inside a conditional command,
   1.172 ++	 we need to special-case characters special to both the shell and
   1.173 ++	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
   1.174 ++      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
   1.175 ++        {
   1.176 ++          if (character == '|')
   1.177 ++            goto got_character;
   1.178 ++
   1.179 ++	  push_delimiter (dstack, character);
   1.180 ++	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
   1.181 ++	  pop_delimiter (dstack);
   1.182 ++	  if (ttok == &matched_pair_error)
   1.183 ++	    return -1;		/* Bail immediately. */
   1.184 ++	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
   1.185 ++				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
   1.186 ++	  token[token_index++] = character;
   1.187 ++	  strcpy (token + token_index, ttok);
   1.188 ++	  token_index += ttoklen;
   1.189 ++	  FREE (ttok);
   1.190 ++	  dollar_present = all_digit_token = 0;
   1.191 ++	  goto next_character;
   1.192 ++        }
   1.193 ++#endif /* COND_REGEXP */
   1.194 ++
   1.195 + #ifdef EXTENDED_GLOB
   1.196 +       /* Parse a ksh-style extended pattern matching specification. */
   1.197 +-      if (extended_glob && PATTERN_CHAR (character))
   1.198 ++      if MBTEST(extended_glob && PATTERN_CHAR (character))
   1.199 + 	{
   1.200 + 	  peek_char = shell_getc (1);
   1.201 + 	  if MBTEST(peek_char == '(')		/* ) */
   1.202 +Index: patchlevel.h
   1.203 +--- patchlevel.h.orig	2006-04-13 14:31:04 +0200
   1.204 ++++ patchlevel.h	2006-12-06 13:32:45 +0100
   1.205 +@@ -25,6 +25,6 @@
   1.206 +    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
   1.207 +    looks for to find the patch level (for the sccs version string). */
   1.208 + 
   1.209 +-#define PATCHLEVEL 0
   1.210 ++#define PATCHLEVEL 5
   1.211 + 
   1.212 + #endif /* _PATCHLEVEL_H_ */
   1.213 +Index: subst.c
   1.214 +--- subst.c.orig	2006-09-19 14:35:09 +0200
   1.215 ++++ subst.c	2006-12-06 13:32:45 +0100
   1.216 +@@ -5707,6 +5707,11 @@
   1.217 +   vtype &= ~VT_STARSUB;
   1.218 + 
   1.219 +   mflags = 0;
   1.220 ++  if (patsub && *patsub == '/')
   1.221 ++    {
   1.222 ++      mflags |= MATCH_GLOBREP;
   1.223 ++      patsub++;
   1.224 ++    }
   1.225 + 
   1.226 +   /* Malloc this because expand_string_if_necessary or one of the expansion
   1.227 +      functions in its call chain may free it on a substitution error. */
   1.228 +@@ -5741,13 +5746,12 @@
   1.229 +     }
   1.230 + 
   1.231 +   /* ksh93 doesn't allow the match specifier to be a part of the expanded
   1.232 +-     pattern.  This is an extension. */
   1.233 ++     pattern.  This is an extension.  Make sure we don't anchor the pattern
   1.234 ++     at the beginning or end of the string if we're doing global replacement,
   1.235 ++     though. */
   1.236 +   p = pat;
   1.237 +-  if (pat && pat[0] == '/')
   1.238 +-    {
   1.239 +-      mflags |= MATCH_GLOBREP|MATCH_ANY;
   1.240 +-      p++;
   1.241 +-    }
   1.242 ++  if (mflags & MATCH_GLOBREP)
   1.243 ++    mflags |= MATCH_ANY;
   1.244 +   else if (pat && pat[0] == '#')
   1.245 +     {
   1.246 +       mflags |= MATCH_BEG;
   1.247 +Index: y.tab.c
   1.248 +--- y.tab.c.orig	2006-09-25 14:15:16 +0200
   1.249 ++++ y.tab.c	2006-12-06 13:39:36 +0100
   1.250 +@@ -2359,6 +2359,7 @@
   1.251 + #define PST_CMDTOKEN	0x1000		/* command token OK - unused */
   1.252 + #define PST_COMPASSIGN	0x2000		/* parsing x=(...) compound assignment */
   1.253 + #define PST_ASSIGNOK	0x4000		/* assignment statement ok in this context */
   1.254 ++#define PST_REGEXP	0x8000		/* parsing an ERE/BRE as a single word */
   1.255 + 
   1.256 + /* Initial size to allocate for tokens, and the
   1.257 +    amount to grow them by. */
   1.258 +@@ -3921,6 +3922,9 @@
   1.259 +       return (character);
   1.260 +     }
   1.261 + 
   1.262 ++  if (parser_state & PST_REGEXP)
   1.263 ++    goto tokword;
   1.264 ++
   1.265 +   /* Shell meta-characters. */
   1.266 +   if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0))
   1.267 +     {
   1.268 +@@ -4028,6 +4032,7 @@
   1.269 +   if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND))
   1.270 +     return (character);
   1.271 + 
   1.272 ++tokword:
   1.273 +   /* Okay, if we got this far, we have to read a word.  Read one,
   1.274 +      and then check it against the known ones. */
   1.275 +   result = read_token_word (character);
   1.276 +@@ -4065,7 +4070,7 @@
   1.277 + /* itrace("parse_matched_pair: open = %c close = %c", open, close); */
   1.278 +   count = 1;
   1.279 +   pass_next_character = backq_backslash = was_dollar = in_comment = 0;
   1.280 +-  check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   1.281 ++  check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
   1.282 + 
   1.283 +   /* RFLAGS is the set of flags we want to pass to recursive calls. */
   1.284 +   rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE);
   1.285 +@@ -4532,8 +4537,11 @@
   1.286 +       if (tok == WORD && test_binop (yylval.word->word))
   1.287 + 	op = yylval.word;
   1.288 + #if defined (COND_REGEXP)
   1.289 +-      else if (tok == WORD && STREQ (yylval.word->word,"=~"))
   1.290 +-	op = yylval.word;
   1.291 ++      else if (tok == WORD && STREQ (yylval.word->word, "=~"))
   1.292 ++	{
   1.293 ++	  op = yylval.word;
   1.294 ++	  parser_state |= PST_REGEXP;
   1.295 ++	}
   1.296 + #endif
   1.297 +       else if (tok == '<' || tok == '>')
   1.298 + 	op = make_word_from_token (tok);  /* ( */
   1.299 +@@ -4564,6 +4572,7 @@
   1.300 + 
   1.301 +       /* rhs */
   1.302 +       tok = read_token (READ);
   1.303 ++      parser_state &= ~PST_REGEXP;
   1.304 +       if (tok == WORD)
   1.305 + 	{
   1.306 + 	  tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
   1.307 +@@ -4749,9 +4758,34 @@
   1.308 + 	  goto next_character;
   1.309 + 	}
   1.310 + 
   1.311 ++#ifdef COND_REGEXP
   1.312 ++      /* When parsing a regexp as a single word inside a conditional command,
   1.313 ++	 we need to special-case characters special to both the shell and
   1.314 ++	 regular expressions.  Right now, that is only '(' and '|'. */ /*)*/
   1.315 ++      if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|'))		/*)*/
   1.316 ++        {
   1.317 ++          if (character == '|')
   1.318 ++            goto got_character;
   1.319 ++
   1.320 ++	  push_delimiter (dstack, character);
   1.321 ++	  ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
   1.322 ++	  pop_delimiter (dstack);
   1.323 ++	  if (ttok == &matched_pair_error)
   1.324 ++	    return -1;		/* Bail immediately. */
   1.325 ++	  RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2,
   1.326 ++				  token_buffer_size, TOKEN_DEFAULT_GROW_SIZE);
   1.327 ++	  token[token_index++] = character;
   1.328 ++	  strcpy (token + token_index, ttok);
   1.329 ++	  token_index += ttoklen;
   1.330 ++	  FREE (ttok);
   1.331 ++	  dollar_present = all_digit_token = 0;
   1.332 ++	  goto next_character;
   1.333 ++        }
   1.334 ++#endif /* COND_REGEXP */
   1.335 ++
   1.336 + #ifdef EXTENDED_GLOB
   1.337 +       /* Parse a ksh-style extended pattern matching specification. */
   1.338 +-      if (extended_glob && PATTERN_CHAR (character))
   1.339 ++      if MBTEST(extended_glob && PATTERN_CHAR (character))
   1.340 + 	{
   1.341 + 	  peek_char = shell_getc (1);
   1.342 + 	  if MBTEST(peek_char == '(')		/* ) */
   1.343 +
   1.344 +-----------------------------------------------------------------------------
   1.345 +
   1.346 +Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64
   1.347 +
   1.348 +Index: Makefile.in
   1.349 +--- Makefile.in.orig	2006-08-17 20:03:35 +0200
   1.350 ++++ Makefile.in	2007-10-15 13:00:34 +0200
   1.351 +@@ -682,13 +682,9 @@
   1.352 + stamp-h:	config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h
   1.353 + 	CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status
   1.354 + 
   1.355 +-config.status:	$(srcdir)/configure
   1.356 ++config.status:
   1.357 + 	$(SHELL) ./config.status --recheck
   1.358 + 
   1.359 +-# comment out for distribution
   1.360 +-$(srcdir)/configure:	$(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in
   1.361 +-	cd $(srcdir) && autoconf
   1.362 +-
   1.363 + # for chet
   1.364 + reconfig: force
   1.365 + 	sh $(srcdir)/configure -C

mercurial