head 1.21; access; symbols OPENPKG_E1_MP_HEAD:1.15 OPENPKG_E1_MP:1.15 OPENPKG_E1_MP_2_STABLE:1.14.2.1 OPENPKG_E1_FP:1.14.2.1 OPENPKG_2_STABLE_MP:1.15 OPENPKG_2_STABLE_20061018:1.14.2.1 OPENPKG_2_STABLE_20060622:1.14 OPENPKG_2_STABLE:1.14.0.2 OPENPKG_2_STABLE_BP:1.14 OPENPKG_2_5_RELEASE:1.12 OPENPKG_2_5_SOLID:1.12.0.6 OPENPKG_2_5_SOLID_BP:1.12 OPENPKG_2_4_RELEASE:1.12 OPENPKG_2_4_SOLID:1.12.0.4 OPENPKG_2_4_SOLID_BP:1.12 OPENPKG_CW_FP:1.12 OPENPKG_2_3_RELEASE:1.12 OPENPKG_2_3_SOLID:1.12.0.2 OPENPKG_2_3_SOLID_BP:1.12 OPENPKG_2_2_RELEASE:1.11 OPENPKG_2_2_SOLID:1.11.0.2 OPENPKG_2_2_SOLID_BP:1.11 OPENPKG_2_1_RELEASE:1.5 OPENPKG_2_1_SOLID:1.5.0.2 OPENPKG_2_1_SOLID_BP:1.5 OPENPKG_2_0_RELEASE:1.3 OPENPKG_2_0_SOLID:1.3.0.2 OPENPKG_2_0_SOLID_BP:1.3 OPENPKG_1_3_RELEASE:1.2.2.1 OPENPKG_1_3_SOLID:1.2.2.1.0.2 OPENPKG_1_3_SOLID_BP:1.2.2.1 OPENPKG_1_STABLE_MP:1.2 OPENPKG_1_STABLE:1.2.0.2; locks; strict; comment @# @; 1.21 date 2009.03.05.14.50.29; author rse; state Exp; branches; next 1.20; commitid ZUzIFIfDXK751REt; 1.20 date 2009.02.23.21.48.28; author rse; state Exp; branches; next 1.19; commitid 5WDpyxnfiTEoEBDt; 1.19 date 2008.04.30.18.13.34; author rse; state Exp; branches; next 1.18; commitid ZZlLSPnmS0oy4a1t; 1.18 date 2008.04.30.17.44.27; author rse; state Exp; branches; next 1.17; commitid ht6yYfSkDl8zU91t; 1.17 date 2008.03.28.14.32.19; author rse; state Exp; branches; next 1.16; commitid cZuxHKb08MBpUTWs; 1.16 date 2007.07.10.16.58.12; author rse; state Exp; branches; next 1.15; commitid ztC3LPLZAuXA8fps; 1.15 date 2006.10.11.14.43.52; author cs; state Exp; branches; next 1.14; commitid gGk9eBuWWmmA8hQr; 1.14 date 2006.03.06.21.50.50; author rse; state Exp; branches 1.14.2.1; next 1.13; commitid JDDvNTqllaBvxaor; 1.13 date 2005.12.08.19.19.11; author rse; state Exp; branches; next 1.12; commitid pxxhvFTeteJQwQcr; 1.12 date 2004.11.04.09.47.56; author rse; state Exp; branches; next 1.11; 1.11 date 2004.09.09.07.18.58; author rse; state Exp; branches 1.11.2.1; next 1.10; 1.10 date 2004.08.11.13.20.46; author rse; state Exp; branches; next 1.9; 1.9 date 2004.08.06.10.49.36; author tho; state Exp; branches; next 1.8; 1.8 date 2004.07.28.19.19.57; author rse; state Exp; branches; next 1.7; 1.7 date 2004.07.28.08.24.40; author rse; state Exp; branches; next 1.6; 1.6 date 2004.07.27.18.50.06; author rse; state Exp; branches; next 1.5; 1.5 date 2004.06.07.08.34.35; author rse; state Exp; branches; next 1.4; 1.4 date 2004.06.04.10.05.47; author rse; state Exp; branches; next 1.3; 1.3 date 2003.10.06.15.37.46; author rse; state Exp; branches; next 1.2; 1.2 date 2003.07.25.14.42.45; author rse; state Exp; branches 1.2.2.1; next 1.1; 1.1 date 2003.07.25.14.27.21; author rse; state Exp; branches; next ; 1.14.2.1 date 2006.10.16.14.48.25; author rse; state Exp; branches; next ; commitid iZxwRSmmWscPXUQr; 1.11.2.1 date 2004.11.04.11.51.33; author rse; state Exp; branches; next ; 1.2.2.1 date 2003.07.26.13.36.14; author rse; state Exp; branches; next ; desc @@ 1.21 log @fix building under Linux @ text @This patch documents two implemented and classical command line options "-v" and "-x". It is derived from Debian GNU/Linux. Index: doc/bash.1 --- doc/bash.1.orig 2009-02-18 21:13:56 +0100 +++ doc/bash.1 2009-02-21 20:52:27 +0100 @@@@ -115,6 +115,12 @@@@ This option allows the positional parameters to be set when invoking an interactive shell. .TP +.B \-v +Print shell input lines as they are read. +.TP +.B \-x +Print commands and their arguments as they are executed. +.TP .B \-D A list of all double-quoted strings preceded by \fB$\fP is printed on the standard output. ----------------------------------------------------------------------------- Port to HP-UX 11i and similar less smart platforms. Index: configure --- configure.orig 2009-02-09 14:33:13 +0100 +++ configure 2009-02-21 20:52:27 +0100 @@@@ -2198,6 +2198,7 @@@@ *-beos*) opt_bash_malloc=no ;; # they say it's suitable *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX esac # memory scrambling on free() @@@@ -2345,7 +2346,7 @@@@ else MALLOC_LIB= - MALLOC_LIBRARY= + MALLOC_LIBRARY=dummy MALLOC_LDFLAGS= MALLOC_DEP= fi Index: syntax.h --- syntax.h.orig 2009-01-04 20:32:42 +0100 +++ syntax.h 2009-02-21 20:52:27 +0100 @@@@ -21,6 +21,8 @@@@ #ifndef _SYNTAX_H_ #define _SYNTAX_H_ +#include "config.h" + /* Defines for use by mksyntax.c */ #define slashify_in_quotes "\\`$\"\n" ----------------------------------------------------------------------------- This adds the OpenPKG packaging brand. Index: version.c --- version.c.orig 2009-01-04 20:32:46 +0100 +++ version.c 2009-02-21 20:53:12 +0100 @@@@ -83,7 +83,7 @@@@ show_shell_version (extended) int extended; { - printf (_("GNU bash, version %s (%s)\n"), shell_version_string (), MACHTYPE); + printf (_("GNU bash, version %s (%s) [@@l_openpkg_release@@]\n"), shell_version_string (), MACHTYPE); if (extended) { printf ("%s\n", _(bash_copyright)); ----------------------------------------------------------------------------- Ensure that Autoconf and friends are not run. Index: Makefile.in --- Makefile.in.orig 2009-01-04 20:32:39 +0100 +++ Makefile.in 2009-02-21 20:52:27 +0100 @@@@ -704,7 +704,6 @@@@ # comment out for distribution $(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4 $(srcdir)/config.h.in - cd $(srcdir) && autoconf # for chet reconfig: force ----------------------------------------------------------------------------- Fix Bash getcwd(3) run-time issue seen on Solaris where size argument of 0 does not malloc buffer as expected by Bash code. Index: builtins/common.c --- builtins/common.c.orig 2009-01-16 05:06:55 +0100 +++ builtins/common.c 2009-02-21 20:52:27 +0100 @@@@ -553,10 +553,11 @@@@ if (the_current_working_directory == 0) { + char *t = xmalloc(PATH_MAX); #if defined (GETCWD_BROKEN) - the_current_working_directory = getcwd (0, PATH_MAX); + the_current_working_directory = getcwd (t, PATH_MAX); #else - the_current_working_directory = getcwd (0, 0); + the_current_working_directory = getcwd (t, PATH_MAX); #endif if (the_current_working_directory == 0) { ----------------------------------------------------------------------------- Fix building under Linux. Index: externs.h --- externs.h.orig 2009-01-19 00:29:29.000000000 +0100 +++ externs.h 2009-03-05 15:36:17.745625574 +0100 @@@@ -25,6 +25,7 @@@@ # define _EXTERNS_H_ #include "stdc.h" +#include /* Functions from expr.c. */ extern intmax_t evalexp __P((char *, int *)); @ 1.20 log @upgrading package: bash 3.2.48 -> 4.0.0 @ text @d113 17 @ 1.19 log @apply the Solaris getcwd(3) fix @ text @d5 3 a7 3 --- doc/bash.1.orig 2006-10-03 14:54:26 +0200 +++ doc/bash.1 2008-03-28 15:28:44 +0100 @@@@ -116,6 +116,12 @@@@ d26 3 a28 3 --- configure.orig 2006-09-26 17:06:01 +0200 +++ configure 2008-03-28 15:28:44 +0100 @@@@ -1517,6 +1517,7 @@@@ d36 1 a36 1 @@@@ -1662,7 +1663,7 @@@@ d46 2 a47 2 --- syntax.h.orig 2006-06-22 19:45:22 +0200 +++ syntax.h 2008-03-28 15:28:44 +0100 d63 3 a65 3 --- version.c.orig 2005-05-16 17:58:34 +0200 +++ version.c 2008-03-28 15:28:44 +0100 @@@@ -77,7 +77,7 @@@@ d69 2 a70 2 - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); + printf ("GNU bash, version %s (%s) [@@l_openpkg_release@@]\n", shell_version_string (), MACHTYPE); d72 2 a73 2 printf (_("Copyright (C) 2005 Free Software Foundation, Inc.\n")); } d80 3 a82 3 --- Makefile.in.orig 2006-08-17 20:03:35 +0200 +++ Makefile.in 2008-03-28 15:28:44 +0100 @@@@ -687,7 +687,6 @@@@ d97 3 a99 3 --- builtins/common.c.orig 2008-04-30 20:08:34 +0200 +++ builtins/common.c 2008-04-30 20:09:18 +0200 @@@@ -475,10 +479,11 @@@@ a112 138 ----------------------------------------------------------------------------- Provide the y.tab.[ch] patches corresponding to what Bash 3.2 patches 001-039 apply to parse.y in order to not require that this package has dependencies to the GNU bison package. --- y.tab.c.orig 2008-04-30 19:34:48 +0200 +++ y.tab.c 2008-04-30 19:39:08 +0200 @@@@ -2359,6 +2359,7 @@@@ #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ +#define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ /* Initial size to allocate for tokens, and the amount to grow them by. */ @@@@ -3921,6 +3922,9 @@@@ return (character); } + if (parser_state & PST_REGEXP) + goto tokword; + /* Shell meta-characters. */ if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) { @@@@ -4028,6 +4032,7 @@@@ if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) return (character); +tokword: /* Okay, if we got this far, we have to read a word. Read one, and then check it against the known ones. */ result = read_token_word (character); @@@@ -4065,7 +4070,7 @@@@ /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ count = 1; pass_next_character = backq_backslash = was_dollar = in_comment = 0; - check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; + check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; /* RFLAGS is the set of flags we want to pass to recursive calls. */ rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); @@@@ -4532,8 +4537,11 @@@@ if (tok == WORD && test_binop (yylval.word->word)) op = yylval.word; #if defined (COND_REGEXP) - else if (tok == WORD && STREQ (yylval.word->word,"=~")) - op = yylval.word; + else if (tok == WORD && STREQ (yylval.word->word, "=~")) + { + op = yylval.word; + parser_state |= PST_REGEXP; + } #endif else if (tok == '<' || tok == '>') op = make_word_from_token (tok); /* ( */ @@@@ -4564,6 +4572,7 @@@@ /* rhs */ tok = read_token (READ); + parser_state &= ~PST_REGEXP; if (tok == WORD) { tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); @@@@ -4697,7 +4706,7 @@@@ if (pass_next_character) { pass_next_character = 0; - goto got_character; + goto got_escaped_character; } cd = current_delimiter (dstack); @@@@ -4749,9 +4758,34 @@@@ goto next_character; } +#ifdef COND_REGEXP + /* When parsing a regexp as a single word inside a conditional command, + we need to special-case characters special to both the shell and + regular expressions. Right now, that is only '(' and '|'. */ /*)*/ + if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/ + { + if (character == '|') + goto got_character; + + push_delimiter (dstack, character); + ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0); + pop_delimiter (dstack); + if (ttok == &matched_pair_error) + return -1; /* Bail immediately. */ + RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2, + token_buffer_size, TOKEN_DEFAULT_GROW_SIZE); + token[token_index++] = character; + strcpy (token + token_index, ttok); + token_index += ttoklen; + FREE (ttok); + dollar_present = all_digit_token = 0; + goto next_character; + } +#endif /* COND_REGEXP */ + #ifdef EXTENDED_GLOB /* Parse a ksh-style extended pattern matching specification. */ - if (extended_glob && PATTERN_CHAR (character)) + if MBTEST(extended_glob && PATTERN_CHAR (character)) { peek_char = shell_getc (1); if MBTEST(peek_char == '(') /* ) */ @@@@ -4946,12 +4980,14 @@@@ got_character: - all_digit_token &= DIGIT (character); - dollar_present |= character == '$'; - if (character == CTLESC || character == CTLNUL) token[token_index++] = CTLESC; + got_escaped_character: + + all_digit_token &= DIGIT (character); + dollar_present |= character == '$'; + token[token_index++] = character; RESIZE_MALLOCED_BUFFER (token, token_index, 1, token_buffer_size, @@@@ -5660,7 +5696,7 @@@@ if (promptvars || posixly_correct) { last_exit_value = last_command_exit_value; - list = expand_prompt_string (result, Q_DOUBLE_QUOTES); + list = expand_prompt_string (result, Q_DOUBLE_QUOTES, 0); free (result); result = string_list (list); dispose_words (list); @ 1.18 log @upgrading package: bash 3.2.33 -> 3.2.39 @ text @d93 23 @ 1.17 log @update patch file to fit exactly fitout fuzzy matching requirements @ text @d91 137 @ 1.16 log @ok, ok, then let's take the larger hammer to ensure that this doesn't need Autoconf and friends for building @ text @d5 2 a6 2 --- doc/bash.1.orig 2004-07-12 17:27:08 +0200 +++ doc/bash.1 2004-07-27 19:47:10 +0200 d19 1 a19 1 is printed on the standard ouput. d26 2 a27 2 --- configure.orig 2004-07-21 22:18:56 +0200 +++ configure 2004-07-27 19:47:10 +0200 d46 2 a47 2 --- syntax.h.orig 2004-04-15 05:19:36 +0200 +++ syntax.h 2004-07-27 19:47:10 +0200 d63 2 a64 2 --- version.c.orig 2003-12-19 22:34:02 +0100 +++ version.c 2004-07-27 19:47:10 +0200 d72 1 a72 1 printf (_("Copyright (C) 2004 Free Software Foundation, Inc.\n")); d81 1 a81 1 +++ Makefile.in 2007-07-10 18:50:38 +0200 @ 1.15 log @upgrading package: bash 3.1.17 -> 3.2.16 @ text @d75 16 @ 1.14 log @Remove dependency to Bison/Yacc by applying a vendor patch to a generated file. @ text @d7 1 a7 1 @@@@ -113,6 +113,12 @@@@ a22 39 This patch makes sure a signal state variable is declared "volatile" so it is consistent throughout signal handling. This patch is derived from SuSE Linux. Index: quit.h --- quit.h.orig 2001-09-10 16:08:33 +0200 +++ quit.h 2004-07-27 19:47:10 +0200 @@@@ -22,7 +22,7 @@@@ #define _QUIT_H_ /* Non-zero means SIGINT has already ocurred. */ -extern int interrupt_state; +extern volatile int interrupt_state; /* Macro to call a great deal. SIGINT just sets above variable. When it is safe, put QUIT in the code, and the "interrupt" will take place. */ Index: sig.c --- sig.c.orig 2003-12-19 22:11:35 +0100 +++ sig.c 2004-07-27 19:47:10 +0200 @@@@ -59,7 +59,7 @@@@ extern int parse_and_execute_level, shell_initialized; /* Non-zero after SIGINT. */ -int interrupt_state; +volatile int interrupt_state = 0; /* The environment at the top-level R-E loop. We use this in the case of error return. */ @@@@ -71,7 +71,7 @@@@ #endif /* JOB_CONTROL */ /* When non-zero, we throw_to_top_level (). */ -int interrupt_immediately = 0; +volatile int interrupt_immediately = 0; static void initialize_shell_signals __P((void)); ----------------------------------------------------------------------------- d28 1 a28 1 @@@@ -1479,6 +1479,7 @@@@ d36 1 a36 1 @@@@ -1624,7 +1625,7 @@@@ a74 16 ----------------------------------------------------------------------------- Remove dependency to Bison/Yacc by applying a vendor patch to a generated file. Index: y.tab.c --- y.tab.c.orig 2005-11-14 15:53:30 +0100 +++ y.tab.c 2006-03-06 22:46:56 +0100 @@@@ -4237,7 +4237,7 @@@@ if (open == ch) /* undo previous increment */ count--; if (ch == '(') /* ) */ - nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE); else if (ch == '{') /* } */ nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); else if (ch == '[') /* ] */ @ 1.14.2.1 log @Mass merge from CURRENT to 2-STABLE (all packages except those of JUNK class) @ text @d7 1 a7 1 @@@@ -116,6 +116,12 @@@@ d23 39 d67 1 a67 1 @@@@ -1517,6 +1517,7 @@@@ d75 1 a75 1 @@@@ -1662,7 +1663,7 @@@@ d114 16 @ 1.13 log @upgrading package: bash 3.0.16 -> 3.1.0 @ text @d114 16 @ 1.12 log @On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or between Gentoo 1.4.x and 1.5.x) the system headers provide the waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 and 2.6 still do not support this option and return EINVAL on waitpid(2) using WCONTINUED. As a side-effect the GNU Bash goes into an endless loop with waitpid(3) calls after the first executed command terminated. The following patch is derived from Gentoo Portage and workarounds this problems by gracefully and efficiently degrading the options on waitpid(2) calls. Well, it's just another great example of how good Linux provides standardized APIs -- actually they are nothing more than Potemkin villages. Ggrrrrr! @ text @a22 35 This patch adds an explicit recognition for terminal sequence "kD" to be "Delete" key. This is derived from Debian GNU/Linux and SuSE Linux. Index: lib/readline/terminal.c --- lib/readline/terminal.c.orig 2003-09-18 17:03:42 +0200 +++ lib/readline/terminal.c 2004-07-27 20:03:17 +0200 @@@@ -145,6 +145,9 @@@@ static char *_rl_term_kH; static char *_rl_term_at7; /* @@7 */ +/* The key sequence sent by the Delete key, if any. */ +static char *_rl_term_kD; + /* Insert key */ static char *_rl_term_kI; @@@@ -313,6 +316,7 @@@@ { "ei", &_rl_term_ei }, { "ic", &_rl_term_ic }, { "im", &_rl_term_im }, + { "kD", &_rl_term_kD }, /* delete */ { "kH", &_rl_term_kH }, /* home down ?? */ { "kI", &_rl_term_kI }, /* insert */ { "kd", &_rl_term_kd }, @@@@ -492,6 +496,7 @@@@ rl_bind_keyseq_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ + rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete); /* Delete */ _rl_keymap = xkeymap; } ----------------------------------------------------------------------------- a113 79 ----------------------------------------------------------------------------- Fix timezone handling for HPUX Index: lib/sh/strftime.c --- lib/sh/strftime.c.orig 2004-03-04 04:13:23 +0100 +++ lib/sh/strftime.c 2004-08-06 12:40:06 +0200 @@@@ -97,6 +97,8 @@@@ extern int daylight; #if defined(SOLARIS) || defined(mips) || defined (M_UNIX) extern long int timezone, altzone; +#elif defined(HPUX) +extern long int timezone; #else extern int timezone, altzone; #endif @@@@ -480,7 +482,11 @@@@ * Systems with tzname[] probably have timezone as * secs west of GMT. Convert to mins east of GMT. */ +#if defined(HPUX) + off = -(timezone / 60); +#else off = -(daylight ? timezone : altzone) / 60; +#endif /* HPUX */ #else /* !HAVE_TZNAME */ off = -zone.tz_minuteswest; #endif /* !HAVE_TZNAME */ ----------------------------------------------------------------------------- On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or between Gentoo 1.4.x and 1.5.x) the system headers provide the waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 and 2.6 still do not support this option and return EINVAL on waitpid(2) using WCONTINUED. As a side-effect the GNU Bash goes into an endless loop with waitpid(3) calls after the first executed command terminated. The following patch is derived from Gentoo Portage and workarounds this problems by gracefully and efficiently degrading the options on waitpid(2) calls. Well, it's just another great example of how good Linux provides standardized APIs -- actually they are nothing more than Potemkin villages. Ggrrrrr! Index: jobs.c --- jobs.c.orig 2004-11-04 10:29:23 +0100 +++ jobs.c 2004-11-04 10:32:47 +0100 @@@@ -2476,6 +2476,9 @@@@ PROCESS *child; pid_t pid; int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; +#ifdef __linux__ + static int wcontinued_not_supported = 0; +#endif call_set_current = children_exited = 0; last_stopped_job = NO_JOB; @@@@ -2489,7 +2492,18 @@@@ : 0; if (sigchld || block == 0) waitpid_flags |= WNOHANG; +#ifdef __linux__ + retry: + if (wcontinued_not_supported) + waitpid_flags &= ~WCONTINUED; +#endif pid = WAITPID (-1, &status, waitpid_flags); +#ifdef __linux__ + if (pid == -1 && errno == EINVAL) { + wcontinued_not_supported = 1; + goto retry; + } +#endif /* The check for WNOHANG is to make sure we decrement sigchld only if it was non-zero before we called waitpid. */ @ 1.11 log @upgrading package: bash 3.0.0 -> 3.0.13 @ text @d178 50 @ 1.11.2.1 log @MFC: On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or between Gentoo 1.4.x and 1.5.x) the system headers provide the waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 and 2.6 still do not support this option and return EINVAL on waitpid(2) using WCONTINUED. As a side-effect the GNU Bash goes into an endless loop with waitpid(3) calls after the first executed command terminated. The following patch is derived from Gentoo Portage and workarounds this problems by gracefully and efficiently degrading the options on waitpid(2) calls. Well, it's just another great example of how good Linux provides standardized APIs -- actually they are nothing more than Potemkin villages. Ggrrrrr! @ text @a177 50 ----------------------------------------------------------------------------- On brain-dead Linux platforms somewhere between glibc 2.3.3 (20040405) and glibc 2.3.3 (20040917) (e.g. between SuSE 9.1 and SuSE 9.2 or between Gentoo 1.4.x and 1.5.x) the system headers provide the waitpid(2) option WCONTINUED although the underlying Linux kernels 2.4 and 2.6 still do not support this option and return EINVAL on waitpid(2) using WCONTINUED. As a side-effect the GNU Bash goes into an endless loop with waitpid(3) calls after the first executed command terminated. The following patch is derived from Gentoo Portage and workarounds this problems by gracefully and efficiently degrading the options on waitpid(2) calls. Well, it's just another great example of how good Linux provides standardized APIs -- actually they are nothing more than Potemkin villages. Ggrrrrr! Index: jobs.c --- jobs.c.orig 2004-11-04 10:29:23 +0100 +++ jobs.c 2004-11-04 10:32:47 +0100 @@@@ -2476,6 +2476,9 @@@@ PROCESS *child; pid_t pid; int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; +#ifdef __linux__ + static int wcontinued_not_supported = 0; +#endif call_set_current = children_exited = 0; last_stopped_job = NO_JOB; @@@@ -2489,7 +2492,18 @@@@ : 0; if (sigchld || block == 0) waitpid_flags |= WNOHANG; +#ifdef __linux__ + retry: + if (wcontinued_not_supported) + waitpid_flags &= ~WCONTINUED; +#endif pid = WAITPID (-1, &status, waitpid_flags); +#ifdef __linux__ + if (pid == -1 && errno == EINVAL) { + wcontinued_not_supported = 1; + goto retry; + } +#endif /* The check for WNOHANG is to make sure we decrement sigchld only if it was non-zero before we called waitpid. */ @ 1.10 log @apply to more segfault fixing patches @ text @a150 25 Fix display handling of multi-line prompts. Index: lib/readline/display.c --- lib/readline/display.c.orig 2004-05-28 04:57:51 +0200 +++ lib/readline/display.c 2004-07-28 20:17:43 +0200 @@@@ -351,14 +351,14 @@@@ local_prompt = expand_prompt (p, &prompt_visible_length, &prompt_last_invisible, (int *)NULL, - (int *)NULL); + &prompt_physical_chars); c = *t; *t = '\0'; /* The portion of the prompt string up to and including the final newline is now null-terminated. */ local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, (int *)NULL, &prompt_invis_chars_first_line, - &prompt_physical_chars); + (int *)NULL); *t = c; return (prompt_prefix_length); } ----------------------------------------------------------------------------- a177 34 ----------------------------------------------------------------------------- Fix segfault when accessing an unset array. http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00026.html Index: arrayfunc.c --- arrayfunc.c.orig 2003-12-19 06:03:09 +0100 +++ arrayfunc.c 2004-08-11 15:17:03 +0200 @@@@ -611,7 +611,7 @@@@ var = find_variable (t); free (t); - return var; + return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var; } /* Return a string containing the elements in the array and subscript ----------------------------------------------------------------------------- Fix nested brace vs. variable expansion. http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00056.html Index: braces.c --- braces.c.orig 2003-12-04 17:09:52 +0100 +++ braces.c 2004-08-11 15:18:14 +0200 @@@@ -402,6 +402,7 @@@@ { pass_next = 1; i++; + level++; continue; } #endif @ 1.9 log @fixed timezone handling for HPUX @ text @d202 35 @ 1.8 log @second attempt to upgrade to GNU Bash 3.0 (now including a still unreleased patch from the vendor which fixes the multi-line prompt bug) @ text @d174 28 @ 1.7 log @temporarily downgrade again to Bash 2.05b because Bash 3.0 has a horribly broken multi-line prompt handling (which we require in 'openpkg dev' and in our private configurations) @ text @d1 2 a2 18 This patch makes sure Bash does not segfault on empty here documents. It is derived from Gentoo Linux. The problem can be reproduced with "xargs <<< ${EMTPY_VARIABLE}". --- redir.c 2002-03-12 20:27:38.000000000 +0000 +++ redir.c 2003-05-01 13:04:07.000000000 +0100 @@@@ -263,8 +263,10 @@@@ int herelen, n, e; herestr = expand_string_to_string (redirectee->word, 0); - herelen = strlen (herestr); + /* verify string wasnt empty */ + herelen = (herestr == NULL) ? 0 : strlen (herestr); + n = write (fd, herestr, herelen); if (n == herelen) { d4 4 a7 8 ----------------------------------------------------------------------------- This patch documents two implemented and classical command line options "-v" and "-v". It is derived from Debian GNU/Linux. --- doc/bash.1 Wed Jan 20 22:48:04 1999 +++ doc/bash.1 Sun Nov 14 13:26:59 1999 @@@@ -104,6 +104,12 @@@@ d23 29 a51 17 This patch makes sure Bash does not segfault on on "shift" under "shopt -s shift_verbose". It is a null pointer dereference caused by an erroneous assumption that, when the number of arguments to shift exceeds the number of arguments available for shifting, the latter is always explicitly specified on the command line rather than left implicit at the default 1. The patch was derived from Debian GNU/Linux. --- builtins/shift.def.orig 2002-10-22 01:05:10.000000000 -0400 +++ builtins/shift.def 2002-10-22 01:05:06.000000000 -0400 @@@@ -68,7 +68,7 @@@@ else if (times > number_of_args ()) { if (print_shift_error) - sh_erange (list->word->word, "shift count"); + sh_erange (list ? list->word->word : NULL, "shift count"); return (EXECUTION_FAILURE); } d53 2 d62 4 a65 4 --- quit.h +++ quit.h Wed May 2 17:38:34 2001 @@@@ -21,8 +21,8 @@@@ #if !defined (_QUIT_H_) d74 5 a78 4 --- sig.c +++ sig.c Wed May 2 17:36:17 2001 @@@@ -57,7 +57,7 @@@@ extern int interactive, interactive_shell, login_shell, startup_state; d86 1 a86 1 @@@@ -69,7 +69,7 @@@@ d93 1 a93 32 static void initialize_shell_signals (); ----------------------------------------------------------------------------- This patch adds an explicit recognition for terminal sequence "kD" to be "Delete" key. This is derived from Debian GNU/Linux and SuSE Linux. --- lib/readline/terminal.c +++ lib/readline/terminal.c Thu Jul 18 14:34:00 2002 @@@@ -145,6 +145,9 @@@@ static char *_rl_term_kH; static char *_rl_term_at7; /* @@7 */ +/* The key sequence sent by the Delete key, if any. */ +static char *_rl_term_kD; + /* Insert key */ static char *_rl_term_kI; @@@@ -313,6 +316,7 @@@@ { "ei", &_rl_term_ei }, { "ic", &_rl_term_ic }, { "im", &_rl_term_im }, + { "kD", &_rl_term_kD }, /* delete */ { "kH", &_rl_term_kH }, /* home down ?? */ { "kI", &_rl_term_kI }, /* insert */ { "kd", &_rl_term_kd }, @@@@ -496,6 +500,7 @@@@ _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ + _rl_bind_if_unbound (_rl_term_kD, rl_delete); /* Delete */ a94 37 _rl_keymap = xkeymap; } ----------------------------------------------------------------------------- This patch makes sure Bash does not segfault on a particular error. It is derived from RedHat Linux. --- builtins/common.c.warnings 2003-03-25 17:48:02.000000000 +0000 +++ builtins/common.c 2003-03-25 17:49:03.000000000 +0000 @@@@ -244,7 +244,7 @@@@ char *s; { if (s) - builtin_error ("%s: no job control"); + builtin_error ("%s: no job control", s); else builtin_error ("no job control"); } ----------------------------------------------------------------------------- This adds the OpenPKG packaging brand. Index: version.c --- version.c.orig 2002-04-03 15:49:19.000000000 +0200 +++ version.c 2003-10-06 17:23:18.000000000 +0200 @@@@ -63,7 +63,7 @@@@ show_shell_version (extended) int extended; { - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); + printf ("GNU bash, version %s (%s) [@@l_openpkg_release@@]\n", shell_version_string (), MACHTYPE); if (extended) printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); } d100 3 a102 3 --- configure.orig 2002-07-16 15:31:47.000000000 +0200 +++ configure 2004-06-07 10:31:26.000000000 +0200 @@@@ -1146,6 +1146,7 @@@@ d110 1 a110 1 @@@@ -1211,7 +1212,7 @@@@ a118 15 Index: mksyntax.c --- mksyntax.c.orig 2002-02-07 15:32:28.000000000 +0100 +++ mksyntax.c 2004-06-04 11:53:19.000000000 +0200 @@@@ -128,7 +128,11 @@@@ switch (i) { +#if defined(__STDC__) case '\a': xbuf[1] = 'a'; break; +#else + case 7: xbuf[1] = 'a'; break; +#endif case '\v': xbuf[1] = 'v'; break; case '\b': xbuf[1] = 'b'; break; case '\f': xbuf[1] = 'f'; break; d120 2 a121 2 --- syntax.h.orig 2002-02-25 17:52:37.000000000 +0100 +++ syntax.h 2004-06-04 11:53:49.000000000 +0200 d131 43 a173 12 Index: builtins/printf.def --- builtins/printf.def.orig 2002-05-13 20:36:04.000000000 +0200 +++ builtins/printf.def 2004-06-04 11:57:44.000000000 +0200 @@@@ -114,7 +114,7 @@@@ static intmax_t getintmax __P((void)); static uintmax_t getuintmax __P((void)); -#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD +#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(HPUX) typedef long double floatmax_t; # define FLOATMAX_CONV "L" # define strtofltmax strtold @ 1.6 log @upgrading package: bash 2.05b.7 -> 3.0.0 @ text @d1 18 a18 2 This patch documents two implemented and classical command line options "-v" and "-x". It is derived from Debian GNU/Linux. d20 8 a27 4 Index: doc/bash.1 --- doc/bash.1.orig 2004-07-12 17:27:08 +0200 +++ doc/bash.1 2004-07-27 19:47:10 +0200 @@@@ -113,6 +113,12 @@@@ d43 17 a59 29 This patch adds an explicit recognition for terminal sequence "kD" to be "Delete" key. This is derived from Debian GNU/Linux and SuSE Linux. Index: lib/readline/terminal.c --- lib/readline/terminal.c.orig 2003-09-18 17:03:42 +0200 +++ lib/readline/terminal.c 2004-07-27 20:03:17 +0200 @@@@ -145,6 +145,9 @@@@ static char *_rl_term_kH; static char *_rl_term_at7; /* @@7 */ +/* The key sequence sent by the Delete key, if any. */ +static char *_rl_term_kD; + /* Insert key */ static char *_rl_term_kI; @@@@ -313,6 +316,7 @@@@ { "ei", &_rl_term_ei }, { "ic", &_rl_term_ic }, { "im", &_rl_term_im }, + { "kD", &_rl_term_kD }, /* delete */ { "kH", &_rl_term_kH }, /* home down ?? */ { "kI", &_rl_term_kI }, /* insert */ { "kd", &_rl_term_kd }, @@@@ -492,6 +496,7 @@@@ rl_bind_keyseq_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ rl_bind_keyseq_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ + rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete); /* Delete */ a60 2 _rl_keymap = xkeymap; } d68 4 a71 4 Index: quit.h --- quit.h.orig 2001-09-10 16:08:33 +0200 +++ quit.h 2004-07-27 19:47:10 +0200 @@@@ -22,7 +22,7 @@@@ d80 4 a83 5 Index: sig.c --- sig.c.orig 2003-12-19 22:11:35 +0100 +++ sig.c 2004-07-27 19:47:10 +0200 @@@@ -59,7 +59,7 @@@@ extern int parse_and_execute_level, shell_initialized; d91 1 a91 1 @@@@ -71,7 +71,7 @@@@ d98 1 a98 1 static void initialize_shell_signals __P((void)); d102 68 d173 3 a175 3 --- configure.orig 2004-07-21 22:18:56 +0200 +++ configure 2004-07-27 19:47:10 +0200 @@@@ -1479,6 +1479,7 @@@@ d183 1 a183 1 @@@@ -1624,7 +1625,7 @@@@ d192 15 d208 2 a209 2 --- syntax.h.orig 2004-04-15 05:19:36 +0200 +++ syntax.h 2004-07-27 19:47:10 +0200 d219 12 a230 17 ----------------------------------------------------------------------------- This adds the OpenPKG packaging brand. Index: version.c --- version.c.orig 2003-12-19 22:34:02 +0100 +++ version.c 2004-07-27 19:47:10 +0200 @@@@ -77,7 +77,7 @@@@ show_shell_version (extended) int extended; { - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); + printf ("GNU bash, version %s (%s) [@@l_openpkg_release@@]\n", shell_version_string (), MACHTYPE); if (extended) printf (_("Copyright (C) 2004 Free Software Foundation, Inc.\n")); } @ 1.5 log @make HP-UX make happy @ text @d1 2 a2 18 This patch makes sure Bash does not segfault on empty here documents. It is derived from Gentoo Linux. The problem can be reproduced with "xargs <<< ${EMTPY_VARIABLE}". --- redir.c 2002-03-12 20:27:38.000000000 +0000 +++ redir.c 2003-05-01 13:04:07.000000000 +0100 @@@@ -263,8 +263,10 @@@@ int herelen, n, e; herestr = expand_string_to_string (redirectee->word, 0); - herelen = strlen (herestr); + /* verify string wasnt empty */ + herelen = (herestr == NULL) ? 0 : strlen (herestr); + n = write (fd, herestr, herelen); if (n == herelen) { d4 4 a7 8 ----------------------------------------------------------------------------- This patch documents two implemented and classical command line options "-v" and "-v". It is derived from Debian GNU/Linux. --- doc/bash.1 Wed Jan 20 22:48:04 1999 +++ doc/bash.1 Sun Nov 14 13:26:59 1999 @@@@ -104,6 +104,12 @@@@ d23 29 a51 17 This patch makes sure Bash does not segfault on on "shift" under "shopt -s shift_verbose". It is a null pointer dereference caused by an erroneous assumption that, when the number of arguments to shift exceeds the number of arguments available for shifting, the latter is always explicitly specified on the command line rather than left implicit at the default 1. The patch was derived from Debian GNU/Linux. --- builtins/shift.def.orig 2002-10-22 01:05:10.000000000 -0400 +++ builtins/shift.def 2002-10-22 01:05:06.000000000 -0400 @@@@ -68,7 +68,7 @@@@ else if (times > number_of_args ()) { if (print_shift_error) - sh_erange (list->word->word, "shift count"); + sh_erange (list ? list->word->word : NULL, "shift count"); return (EXECUTION_FAILURE); } d53 2 d62 4 a65 4 --- quit.h +++ quit.h Wed May 2 17:38:34 2001 @@@@ -21,8 +21,8 @@@@ #if !defined (_QUIT_H_) d74 5 a78 4 --- sig.c +++ sig.c Wed May 2 17:36:17 2001 @@@@ -57,7 +57,7 @@@@ extern int interactive, interactive_shell, login_shell, startup_state; d86 1 a86 1 @@@@ -69,7 +69,7 @@@@ d93 1 a93 1 static void initialize_shell_signals (); a96 68 This patch adds an explicit recognition for terminal sequence "kD" to be "Delete" key. This is derived from Debian GNU/Linux and SuSE Linux. --- lib/readline/terminal.c +++ lib/readline/terminal.c Thu Jul 18 14:34:00 2002 @@@@ -145,6 +145,9 @@@@ static char *_rl_term_kH; static char *_rl_term_at7; /* @@7 */ +/* The key sequence sent by the Delete key, if any. */ +static char *_rl_term_kD; + /* Insert key */ static char *_rl_term_kI; @@@@ -313,6 +316,7 @@@@ { "ei", &_rl_term_ei }, { "ic", &_rl_term_ic }, { "im", &_rl_term_im }, + { "kD", &_rl_term_kD }, /* delete */ { "kH", &_rl_term_kH }, /* home down ?? */ { "kI", &_rl_term_kI }, /* insert */ { "kd", &_rl_term_kd }, @@@@ -496,6 +500,7 @@@@ _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */ _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line); /* End */ + _rl_bind_if_unbound (_rl_term_kD, rl_delete); /* Delete */ _rl_keymap = xkeymap; } ----------------------------------------------------------------------------- This patch makes sure Bash does not segfault on a particular error. It is derived from RedHat Linux. --- builtins/common.c.warnings 2003-03-25 17:48:02.000000000 +0000 +++ builtins/common.c 2003-03-25 17:49:03.000000000 +0000 @@@@ -244,7 +244,7 @@@@ char *s; { if (s) - builtin_error ("%s: no job control"); + builtin_error ("%s: no job control", s); else builtin_error ("no job control"); } ----------------------------------------------------------------------------- This adds the OpenPKG packaging brand. Index: version.c --- version.c.orig 2002-04-03 15:49:19.000000000 +0200 +++ version.c 2003-10-06 17:23:18.000000000 +0200 @@@@ -63,7 +63,7 @@@@ show_shell_version (extended) int extended; { - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE); + printf ("GNU bash, version %s (%s) [@@l_openpkg_release@@]\n", shell_version_string (), MACHTYPE); if (extended) printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n"); } ----------------------------------------------------------------------------- d100 3 a102 3 --- configure.orig 2002-07-16 15:31:47.000000000 +0200 +++ configure 2004-06-07 10:31:26.000000000 +0200 @@@@ -1146,6 +1146,7 @@@@ d110 1 a110 1 @@@@ -1211,7 +1212,7 @@@@ a118 15 Index: mksyntax.c --- mksyntax.c.orig 2002-02-07 15:32:28.000000000 +0100 +++ mksyntax.c 2004-06-04 11:53:19.000000000 +0200 @@@@ -128,7 +128,11 @@@@ switch (i) { +#if defined(__STDC__) case '\a': xbuf[1] = 'a'; break; +#else + case 7: xbuf[1] = 'a'; break; +#endif case '\v': xbuf[1] = 'v'; break; case '\b': xbuf[1] = 'b'; break; case '\f': xbuf[1] = 'f'; break; d120 2 a121 2 --- syntax.h.orig 2002-02-25 17:52:37.000000000 +0100 +++ syntax.h 2004-06-04 11:53:49.000000000 +0200 d131 17 a147 12 Index: builtins/printf.def --- builtins/printf.def.orig 2002-05-13 20:36:04.000000000 +0200 +++ builtins/printf.def 2004-06-04 11:57:44.000000000 +0200 @@@@ -114,7 +114,7 @@@@ static intmax_t getintmax __P((void)); static uintmax_t getuintmax __P((void)); -#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD +#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(HPUX) typedef long double floatmax_t; # define FLOATMAX_CONV "L" # define strtofltmax strtold @ 1.4 log @port to HP-UX 11i and similar less smart platforms ;-) @ text @d174 1 a174 1 +++ configure 2004-06-04 11:51:17.000000000 +0200 d183 9 @ 1.3 log @add OpenPKG branding @ text @d168 54 @ 1.2 log @add one more patch which fixes another segfault @ text @d151 17 @ 1.2.2.1 log @MFC: all changes since last merge @ text @@ 1.1 log @add a bunch of collected patches @ text @d134 17 @