michael@13: This patch documents two implemented and classical command michael@13: line options "-v" and "-x". It is derived from Debian GNU/Linux. michael@13: michael@13: Index: doc/bash.1 michael@13: --- doc/bash.1.orig 2004-07-12 17:27:08 +0200 michael@13: +++ doc/bash.1 2004-07-27 19:47:10 +0200 michael@13: @@ -116,6 +116,12 @@ michael@13: This option allows the positional parameters to be set michael@13: when invoking an interactive shell. michael@13: .TP michael@13: +.B \-v michael@13: +Print shell input lines as they are read. michael@13: +.TP michael@13: +.B \-x michael@13: +Print commands and their arguments as they are executed. michael@13: +.TP michael@13: .B \-D michael@13: A list of all double-quoted strings preceded by \fB$\fP michael@13: is printed on the standard ouput. michael@13: michael@13: ----------------------------------------------------------------------------- michael@13: michael@13: Port to HP-UX 11i and similar less smart platforms. michael@13: michael@13: Index: configure michael@13: --- configure.orig 2004-07-21 22:18:56 +0200 michael@13: +++ configure 2004-07-27 19:47:10 +0200 michael@13: @@ -1517,6 +1517,7 @@ michael@13: *-beos*) opt_bash_malloc=no ;; # they say it's suitable michael@13: *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment michael@13: *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft michael@13: +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX michael@13: esac michael@13: michael@13: # memory scrambling on free() michael@13: @@ -1662,7 +1663,7 @@ michael@13: michael@13: else michael@13: MALLOC_LIB= michael@13: - MALLOC_LIBRARY= michael@13: + MALLOC_LIBRARY=dummy michael@13: MALLOC_LDFLAGS= michael@13: MALLOC_DEP= michael@13: fi michael@13: Index: syntax.h michael@13: --- syntax.h.orig 2004-04-15 05:19:36 +0200 michael@13: +++ syntax.h 2004-07-27 19:47:10 +0200 michael@13: @@ -21,6 +21,8 @@ michael@13: #ifndef _SYNTAX_H_ michael@13: #define _SYNTAX_H_ michael@13: michael@13: +#include "config.h" michael@13: + michael@13: /* Defines for use by mksyntax.c */ michael@13: michael@13: #define slashify_in_quotes "\\`$\"\n" michael@13: michael@13: ----------------------------------------------------------------------------- michael@13: michael@13: This adds the OpenPKG packaging brand. michael@13: michael@13: Index: version.c michael@13: --- version.c.orig 2003-12-19 22:34:02 +0100 michael@13: +++ version.c 2004-07-27 19:47:10 +0200 michael@13: @@ -77,7 +77,7 @@ michael@13: show_shell_version (extended) michael@13: int extended; michael@13: { michael@13: - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); michael@13: + printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE); michael@13: if (extended) michael@13: printf (_("Copyright (C) 2004 Free Software Foundation, Inc.\n")); michael@13: } michael@13: michael@13: ----------------------------------------------------------------------------- michael@13: michael@13: Accumulated vendor patches Bash 3.2 001-005 michael@13: michael@13: Generated via: michael@13: michael@13: $ gunzip /tmp/bash.patch michael@13: $ popd michael@13: $ rm -rf bash-3.2 michael@13: michael@13: Index: parse.y michael@13: --- parse.y.orig 2006-09-19 22:37:21 +0200 michael@13: +++ parse.y 2006-12-06 13:32:45 +0100 michael@13: @@ -1029,6 +1029,7 @@ michael@13: #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ michael@13: #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ michael@13: #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ michael@13: +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ michael@13: michael@13: /* Initial size to allocate for tokens, and the michael@13: amount to grow them by. */ michael@13: @@ -2591,6 +2592,9 @@ michael@13: return (character); michael@13: } michael@13: michael@13: + if (parser_state & PST_REGEXP) michael@13: + goto tokword; michael@13: + michael@13: /* Shell meta-characters. */ michael@13: if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) michael@13: { michael@13: @@ -2698,6 +2702,7 @@ michael@13: if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) michael@13: return (character); michael@13: michael@13: +tokword: michael@13: /* Okay, if we got this far, we have to read a word. Read one, michael@13: and then check it against the known ones. */ michael@13: result = read_token_word (character); michael@13: @@ -2735,7 +2740,7 @@ michael@13: /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ michael@13: count = 1; michael@13: pass_next_character = backq_backslash = was_dollar = in_comment = 0; michael@13: - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; michael@13: + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; michael@13: michael@13: /* RFLAGS is the set of flags we want to pass to recursive calls. */ michael@13: rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); michael@13: @@ -3202,8 +3207,11 @@ michael@13: if (tok == WORD && test_binop (yylval.word->word)) michael@13: op = yylval.word; michael@13: #if defined (COND_REGEXP) michael@13: - else if (tok == WORD && STREQ (yylval.word->word,"=~")) michael@13: - op = yylval.word; michael@13: + else if (tok == WORD && STREQ (yylval.word->word, "=~")) michael@13: + { michael@13: + op = yylval.word; michael@13: + parser_state |= PST_REGEXP; michael@13: + } michael@13: #endif michael@13: else if (tok == '<' || tok == '>') michael@13: op = make_word_from_token (tok); /* ( */ michael@13: @@ -3234,6 +3242,7 @@ michael@13: michael@13: /* rhs */ michael@13: tok = read_token (READ); michael@13: + parser_state &= ~PST_REGEXP; michael@13: if (tok == WORD) michael@13: { michael@13: tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); michael@13: @@ -3419,9 +3428,34 @@ michael@13: goto next_character; michael@13: } michael@13: michael@13: +#ifdef COND_REGEXP michael@13: + /* When parsing a regexp as a single word inside a conditional command, michael@13: + we need to special-case characters special to both the shell and michael@13: + regular expressions. Right now, that is only '(' and '|'. */ /*)*/ michael@13: + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/ michael@13: + { michael@13: + if (character == '|') michael@13: + goto got_character; michael@13: + michael@13: + push_delimiter (dstack, character); michael@13: + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0); michael@13: + pop_delimiter (dstack); michael@13: + if (ttok == &matched_pair_error) michael@13: + return -1; /* Bail immediately. */ michael@13: + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2, michael@13: + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE); michael@13: + token[token_index++] = character; michael@13: + strcpy (token + token_index, ttok); michael@13: + token_index += ttoklen; michael@13: + FREE (ttok); michael@13: + dollar_present = all_digit_token = 0; michael@13: + goto next_character; michael@13: + } michael@13: +#endif /* COND_REGEXP */ michael@13: + michael@13: #ifdef EXTENDED_GLOB michael@13: /* Parse a ksh-style extended pattern matching specification. */ michael@13: - if (extended_glob && PATTERN_CHAR (character)) michael@13: + if MBTEST(extended_glob && PATTERN_CHAR (character)) michael@13: { michael@13: peek_char = shell_getc (1); michael@13: if MBTEST(peek_char == '(') /* ) */ michael@13: Index: patchlevel.h michael@13: --- patchlevel.h.orig 2006-04-13 14:31:04 +0200 michael@13: +++ patchlevel.h 2006-12-06 13:32:45 +0100 michael@13: @@ -25,6 +25,6 @@ michael@13: regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh michael@13: looks for to find the patch level (for the sccs version string). */ michael@13: michael@13: -#define PATCHLEVEL 0 michael@13: +#define PATCHLEVEL 5 michael@13: michael@13: #endif /* _PATCHLEVEL_H_ */ michael@13: Index: subst.c michael@13: --- subst.c.orig 2006-09-19 14:35:09 +0200 michael@13: +++ subst.c 2006-12-06 13:32:45 +0100 michael@13: @@ -5707,6 +5707,11 @@ michael@13: vtype &= ~VT_STARSUB; michael@13: michael@13: mflags = 0; michael@13: + if (patsub && *patsub == '/') michael@13: + { michael@13: + mflags |= MATCH_GLOBREP; michael@13: + patsub++; michael@13: + } michael@13: michael@13: /* Malloc this because expand_string_if_necessary or one of the expansion michael@13: functions in its call chain may free it on a substitution error. */ michael@13: @@ -5741,13 +5746,12 @@ michael@13: } michael@13: michael@13: /* ksh93 doesn't allow the match specifier to be a part of the expanded michael@13: - pattern. This is an extension. */ michael@13: + pattern. This is an extension. Make sure we don't anchor the pattern michael@13: + at the beginning or end of the string if we're doing global replacement, michael@13: + though. */ michael@13: p = pat; michael@13: - if (pat && pat[0] == '/') michael@13: - { michael@13: - mflags |= MATCH_GLOBREP|MATCH_ANY; michael@13: - p++; michael@13: - } michael@13: + if (mflags & MATCH_GLOBREP) michael@13: + mflags |= MATCH_ANY; michael@13: else if (pat && pat[0] == '#') michael@13: { michael@13: mflags |= MATCH_BEG; michael@13: Index: y.tab.c michael@13: --- y.tab.c.orig 2006-09-25 14:15:16 +0200 michael@13: +++ y.tab.c 2006-12-06 13:39:36 +0100 michael@13: @@ -2359,6 +2359,7 @@ michael@13: #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ michael@13: #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ michael@13: #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ michael@13: +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ michael@13: michael@13: /* Initial size to allocate for tokens, and the michael@13: amount to grow them by. */ michael@13: @@ -3921,6 +3922,9 @@ michael@13: return (character); michael@13: } michael@13: michael@13: + if (parser_state & PST_REGEXP) michael@13: + goto tokword; michael@13: + michael@13: /* Shell meta-characters. */ michael@13: if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) michael@13: { michael@13: @@ -4028,6 +4032,7 @@ michael@13: if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) michael@13: return (character); michael@13: michael@13: +tokword: michael@13: /* Okay, if we got this far, we have to read a word. Read one, michael@13: and then check it against the known ones. */ michael@13: result = read_token_word (character); michael@13: @@ -4065,7 +4070,7 @@ michael@13: /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ michael@13: count = 1; michael@13: pass_next_character = backq_backslash = was_dollar = in_comment = 0; michael@13: - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; michael@13: + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; michael@13: michael@13: /* RFLAGS is the set of flags we want to pass to recursive calls. */ michael@13: rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); michael@13: @@ -4532,8 +4537,11 @@ michael@13: if (tok == WORD && test_binop (yylval.word->word)) michael@13: op = yylval.word; michael@13: #if defined (COND_REGEXP) michael@13: - else if (tok == WORD && STREQ (yylval.word->word,"=~")) michael@13: - op = yylval.word; michael@13: + else if (tok == WORD && STREQ (yylval.word->word, "=~")) michael@13: + { michael@13: + op = yylval.word; michael@13: + parser_state |= PST_REGEXP; michael@13: + } michael@13: #endif michael@13: else if (tok == '<' || tok == '>') michael@13: op = make_word_from_token (tok); /* ( */ michael@13: @@ -4564,6 +4572,7 @@ michael@13: michael@13: /* rhs */ michael@13: tok = read_token (READ); michael@13: + parser_state &= ~PST_REGEXP; michael@13: if (tok == WORD) michael@13: { michael@13: tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); michael@13: @@ -4749,9 +4758,34 @@ michael@13: goto next_character; michael@13: } michael@13: michael@13: +#ifdef COND_REGEXP michael@13: + /* When parsing a regexp as a single word inside a conditional command, michael@13: + we need to special-case characters special to both the shell and michael@13: + regular expressions. Right now, that is only '(' and '|'. */ /*)*/ michael@13: + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/ michael@13: + { michael@13: + if (character == '|') michael@13: + goto got_character; michael@13: + michael@13: + push_delimiter (dstack, character); michael@13: + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0); michael@13: + pop_delimiter (dstack); michael@13: + if (ttok == &matched_pair_error) michael@13: + return -1; /* Bail immediately. */ michael@13: + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2, michael@13: + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE); michael@13: + token[token_index++] = character; michael@13: + strcpy (token + token_index, ttok); michael@13: + token_index += ttoklen; michael@13: + FREE (ttok); michael@13: + dollar_present = all_digit_token = 0; michael@13: + goto next_character; michael@13: + } michael@13: +#endif /* COND_REGEXP */ michael@13: + michael@13: #ifdef EXTENDED_GLOB michael@13: /* Parse a ksh-style extended pattern matching specification. */ michael@13: - if (extended_glob && PATTERN_CHAR (character)) michael@13: + if MBTEST(extended_glob && PATTERN_CHAR (character)) michael@13: { michael@13: peek_char = shell_getc (1); michael@13: if MBTEST(peek_char == '(') /* ) */ michael@13: michael@13: ----------------------------------------------------------------------------- michael@13: michael@13: Do not require autoconf. Fixes build on Solaris 10 8/07 u4 on sparc64 michael@13: michael@13: Index: Makefile.in michael@13: --- Makefile.in.orig 2006-08-17 20:03:35 +0200 michael@13: +++ Makefile.in 2007-10-15 13:00:34 +0200 michael@13: @@ -682,13 +682,9 @@ michael@13: stamp-h: config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h michael@13: CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status michael@13: michael@13: -config.status: $(srcdir)/configure michael@13: +config.status: michael@13: $(SHELL) ./config.status --recheck michael@13: michael@13: -# comment out for distribution michael@13: -$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in michael@13: - cd $(srcdir) && autoconf michael@13: - michael@13: # for chet michael@13: reconfig: force michael@13: sh $(srcdir)/configure -C