Changeset 5cd07a2


Ignore:
Timestamp:
Sep 3, 2007, 10:04:12 PM (17 years ago)
Author:
Jim Gifford <clfs@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
37da1a9
Parents:
91e274a
Message:

Updated Bash 3.2 Patch to -6

Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • BOOK/introduction/common/changelog.xml

    r91e274a r5cd07a2  
    7676          buffer overflows, useradd -G fixes, better name support, and
    7777          the previous useradd fix.</para>
     78        </listitem>
     79        <listitem>
     80          <para>[jim] - Updated Bash 3.2 Patch to -6.</para>
    7881        </listitem>
    7982      </itemizedlist>
  • BOOK/patches.ent

    r91e274a r5cd07a2  
    55<!-- Start of Common Patches -->
    66
    7 <!ENTITY bash-fixes-patch "bash-&bash-version;-fixes-5.patch">
    8 <!ENTITY bash-fixes-patch-md5 "e6dacf6efb8ae0b119d9b03dafb94760">
    9 <!ENTITY bash-fixes-patch-size "32 KB">
     7<!ENTITY bash-fixes-patch "bash-&bash-version;-fixes-6.patch">
     8<!ENTITY bash-fixes-patch-md5 "ea529c1d125a1cfe13b20784821a0bc0">
     9<!ENTITY bash-fixes-patch-size "56 KB">
    1010
    1111<!ENTITY binutils-posix-patch "binutils-&binutils-version;-posix-1.patch">
  • patches/bash-3.2-fixes-6.patch

    r91e274a r5cd07a2  
    1 Submitted By: Joe Ciccone <jciccone@gmail.com>
    2 Date: 2007-07-23
     1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
     2Date: 2007-09-04
    33Initial Package Version: 3.2
    44Origin: ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/
    55Upstream Status: From Upstream
    6 Description: Contains patches 001-017 from upstream
     6Description: Contains patches 001-025 from upstream
    77
    88diff -Naur bash-3.2.orig/array.c bash-3.2/array.c
    9 --- bash-3.2.orig/array.c       2007-07-23 19:54:02.000000000 -0400
    10 +++ bash-3.2/array.c    2007-07-23 19:58:47.000000000 -0400
     9--- bash-3.2.orig/array.c       2005-06-01 13:39:22.000000000 -0700
     10+++ bash-3.2/array.c    2007-09-03 21:59:25.000000000 -0700
    1111@@ -120,7 +120,6 @@
    1212        return(a1);
     
    106106                sifs[0] = ifs ? *ifs : '\0';
    107107diff -Naur bash-3.2.orig/array.h bash-3.2/array.h
    108 --- bash-3.2.orig/array.h       2007-07-23 19:54:02.000000000 -0400
    109 +++ bash-3.2/array.h    2007-07-23 19:58:47.000000000 -0400
     108--- bash-3.2.orig/array.h       2003-06-01 12:50:30.000000000 -0700
     109+++ bash-3.2/array.h    2007-09-03 21:59:25.000000000 -0700
    110110@@ -55,6 +55,7 @@
    111111 extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *));
     
    116116 extern char    *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int));
    117117 extern char    *array_patsub __P((ARRAY *, char *, char *, int));
     118diff -Naur bash-3.2.orig/arrayfunc.c bash-3.2/arrayfunc.c
     119--- bash-3.2.orig/arrayfunc.c   2006-07-27 06:37:59.000000000 -0700
     120+++ bash-3.2/arrayfunc.c        2007-09-03 21:59:34.000000000 -0700
     121@@ -618,6 +618,8 @@
     122   if (expok == 0)
     123     {
     124       last_command_exit_value = EXECUTION_FAILURE;
     125+
     126+      top_level_cleanup ();     
     127       jump_to_top_level (DISCARD);
     128     }
     129   return val;
    118130diff -Naur bash-3.2.orig/builtins/common.c bash-3.2/builtins/common.c
    119 --- bash-3.2.orig/builtins/common.c     2007-07-23 19:54:02.000000000 -0400
    120 +++ bash-3.2/builtins/common.c  2007-07-23 19:58:47.000000000 -0400
     131--- bash-3.2.orig/builtins/common.c     2006-07-27 06:39:51.000000000 -0700
     132+++ bash-3.2/builtins/common.c  2007-09-03 21:59:34.000000000 -0700
    121133@@ -1,4 +1,4 @@
    122134-/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
     
    125137    This file is part of GNU Bash, the Bourne Again SHell.
    126138 
    127 @@ -475,7 +475,11 @@
     139@@ -131,6 +131,7 @@
     140   if (list)
     141     {
     142       builtin_error (_("too many arguments"));
     143+      top_level_cleanup ();
     144       jump_to_top_level (DISCARD);
     145     }
     146 }
     147@@ -395,7 +396,10 @@
     148          if (fatal)
     149            throw_to_top_level ();
     150          else
     151-           jump_to_top_level (DISCARD);
     152+           {
     153+             top_level_cleanup ();
     154+             jump_to_top_level (DISCARD);
     155+           }
     156        }
     157       no_args (list->next);
     158     }
     159@@ -475,7 +479,11 @@
    128160 
    129161   if (the_current_working_directory == 0)
     
    138170          fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
    139171diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def
    140 --- bash-3.2.orig/builtins/printf.def   2007-07-23 19:54:02.000000000 -0400
    141 +++ bash-3.2/builtins/printf.def        2007-07-23 19:58:47.000000000 -0400
     172--- bash-3.2.orig/builtins/printf.def   2006-09-18 05:48:42.000000000 -0700
     173+++ bash-3.2/builtins/printf.def        2007-09-03 21:59:23.000000000 -0700
    142174@@ -1,7 +1,7 @@
    143175 This file is printf.def, from which is created printf.c.
     
    184216 static int printstr __P((char *, char *, int, int, int));
    185217 static int tescape __P((char *, char *, int *));
     218diff -Naur bash-3.2.orig/builtins/read.def bash-3.2/builtins/read.def
     219--- bash-3.2.orig/builtins/read.def     2006-09-19 05:45:48.000000000 -0700
     220+++ bash-3.2/builtins/read.def  2007-09-03 21:59:36.000000000 -0700
     221@@ -127,14 +127,14 @@
     222      WORD_LIST *list;
     223 {
     224   register char *varname;
     225-  int size, i, nr, pass_next, saw_escape, eof, opt, retval, code;
     226-  int input_is_tty, input_is_pipe, unbuffered_read;
     227+  int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
     228+  int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
     229   int raw, edit, nchars, silent, have_timeout, fd;
     230   unsigned int tmout;
     231   intmax_t intval;
     232   char c;
     233   char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
     234-  char *e, *t, *t1;
     235+  char *e, *t, *t1, *ps2;
     236   struct stat tsb;
     237   SHELL_VAR *var;
     238 #if defined (ARRAY_VARS)
     239@@ -148,6 +148,7 @@
     240   USE_VAR(size);
     241   USE_VAR(i);
     242   USE_VAR(pass_next);
     243+  USE_VAR(print_ps2);
     244   USE_VAR(saw_escape);
     245   USE_VAR(input_is_pipe);
     246 /*  USE_VAR(raw); */
     247@@ -163,6 +164,7 @@
     248   USE_VAR(rlind);
     249 #endif
     250   USE_VAR(list);
     251+  USE_VAR(ps2);
     252 
     253   i = 0;               /* Index into the string that we are reading. */
     254   raw = edit = 0;      /* Not reading raw input by default. */
     255@@ -386,7 +388,8 @@
     256   setmode (0, O_TEXT);
     257 #endif
     258 
     259-  for (eof = retval = 0;;)
     260+  ps2 = 0;
     261+  for (print_ps2 = eof = retval = 0;;)
     262     {
     263 #if defined (READLINE)
     264       if (edit)
     265@@ -412,6 +415,15 @@
     266        {
     267 #endif
     268 
     269+      if (print_ps2)
     270+       {
     271+         if (ps2 == 0)
     272+           ps2 = get_string_value ("PS2");
     273+         fprintf (stderr, "%s", ps2 ? ps2 : "");
     274+         fflush (stderr);
     275+         print_ps2 = 0;
     276+       }
     277+
     278       if (unbuffered_read)
     279        retval = zread (fd, &c, 1);
     280       else
     281@@ -440,7 +452,11 @@
     282        {
     283          pass_next = 0;
     284          if (c == '\n')
     285-           i--;                /* back up over the CTLESC */
     286+           {
     287+             i--;              /* back up over the CTLESC */
     288+             if (interactive && input_is_tty && raw == 0)
     289+               print_ps2 = 1;
     290+           }
     291          else
     292            goto add_char;
     293          continue;
    186294diff -Naur bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
    187 --- bash-3.2.orig/config-bot.h  2007-07-23 19:54:02.000000000 -0400
    188 +++ bash-3.2/config-bot.h       2007-07-23 19:58:47.000000000 -0400
     295--- bash-3.2.orig/config-bot.h  2006-09-12 13:43:04.000000000 -0700
     296+++ bash-3.2/config-bot.h       2007-09-03 21:59:22.000000000 -0700
    189297@@ -1,7 +1,7 @@
    190298 /* config-bot.h */
     
    212320 
    213321diff -Naur bash-3.2.orig/config.h.in bash-3.2/config.h.in
    214 --- bash-3.2.orig/config.h.in   2007-07-23 19:54:02.000000000 -0400
    215 +++ bash-3.2/config.h.in        2007-07-23 19:58:47.000000000 -0400
     322--- bash-3.2.orig/config.h.in   2006-09-12 13:00:54.000000000 -0700
     323+++ bash-3.2/config.h.in        2007-09-03 21:59:23.000000000 -0700
    216324@@ -1,6 +1,6 @@
    217325 /* config.h -- Configuration file for bash. */
     
    242350 
    243351diff -Naur bash-3.2.orig/configure bash-3.2/configure
    244 --- bash-3.2.orig/configure     2007-07-23 19:54:02.000000000 -0400
    245 +++ bash-3.2/configure  2007-07-23 19:58:47.000000000 -0400
     352--- bash-3.2.orig/configure     2006-09-26 08:06:01.000000000 -0700
     353+++ bash-3.2/configure  2007-09-03 21:59:22.000000000 -0700
    246354@@ -27316,7 +27316,8 @@
    247355 sco3.2v4*)     LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;;
     
    255363                case "`uname -r`" in
    256364diff -Naur bash-3.2.orig/configure.in bash-3.2/configure.in
    257 --- bash-3.2.orig/configure.in  2007-07-23 19:54:02.000000000 -0400
    258 +++ bash-3.2/configure.in       2007-07-23 19:58:47.000000000 -0400
     365--- bash-3.2.orig/configure.in  2006-09-26 08:05:45.000000000 -0700
     366+++ bash-3.2/configure.in       2007-09-03 21:59:22.000000000 -0700
    259367@@ -5,7 +5,7 @@
    260368 dnl
     
    277385                case "`uname -r`" in
    278386diff -Naur bash-3.2.orig/execute_cmd.c bash-3.2/execute_cmd.c
    279 --- bash-3.2.orig/execute_cmd.c 2007-07-23 19:54:02.000000000 -0400
    280 +++ bash-3.2/execute_cmd.c      2007-07-23 19:58:47.000000000 -0400
     387--- bash-3.2.orig/execute_cmd.c 2006-08-25 21:23:17.000000000 -0700
     388+++ bash-3.2/execute_cmd.c      2007-09-03 21:59:26.000000000 -0700
    281389@@ -1,6 +1,6 @@
    282390 /* execute_cmd.c -- Execute a COMMAND structure. */
     
    308416                        pipe_in, pipe_out, async, fds_to_close,
    309417                        simple_command->flags);
     418diff -Naur bash-3.2.orig/expr.c bash-3.2/expr.c
     419--- bash-3.2.orig/expr.c        2005-12-28 14:47:03.000000000 -0800
     420+++ bash-3.2/expr.c     2007-09-03 21:59:34.000000000 -0700
     421@@ -929,6 +929,7 @@
     422       if (interactive_shell)
     423        {
     424          expr_unwind ();
     425+         top_level_cleanup ();
     426          jump_to_top_level (DISCARD);
     427        }
     428       else
    310429diff -Naur bash-3.2.orig/findcmd.c bash-3.2/findcmd.c
    311 --- bash-3.2.orig/findcmd.c     2007-07-23 19:54:02.000000000 -0400
    312 +++ bash-3.2/findcmd.c  2007-07-23 19:58:47.000000000 -0400
     430--- bash-3.2.orig/findcmd.c     2005-08-17 13:49:54.000000000 -0700
     431+++ bash-3.2/findcmd.c  2007-09-03 21:59:18.000000000 -0700
    313432@@ -308,7 +308,7 @@
    314433   if (hashed_file && (posixly_correct || check_hashed_filenames))
     
    321440          free (hashed_file);
    322441diff -Naur bash-3.2.orig/jobs.c bash-3.2/jobs.c
    323 --- bash-3.2.orig/jobs.c        2007-07-23 19:54:02.000000000 -0400
    324 +++ bash-3.2/jobs.c     2007-07-23 19:58:47.000000000 -0400
    325 @@ -984,8 +984,6 @@
     442--- bash-3.2.orig/jobs.c        2006-07-29 13:40:48.000000000 -0700
     443+++ bash-3.2/jobs.c     2007-09-03 21:59:30.000000000 -0700
     444@@ -783,11 +783,13 @@
     445   if (jobs[js.j_firstj] == 0)
     446     {
     447       old = js.j_firstj++;
     448+      if (old >= js.j_jobslots)
     449+       old = js.j_jobslots - 1;
     450       while (js.j_firstj != old)
     451        {
     452          if (js.j_firstj >= js.j_jobslots)
     453            js.j_firstj = 0;
     454-         if (jobs[js.j_firstj])
     455+         if (jobs[js.j_firstj] || js.j_firstj == old)  /* needed if old == 0 */
     456            break;
     457          js.j_firstj++;
     458        }
     459@@ -797,11 +799,13 @@
     460   if (jobs[js.j_lastj] == 0)
     461     {
     462       old = js.j_lastj--;
     463+      if (old < 0)
     464+       old = 0;
     465       while (js.j_lastj != old)
     466        {
     467          if (js.j_lastj < 0)
     468            js.j_lastj = js.j_jobslots - 1;
     469-         if (jobs[js.j_lastj])
     470+         if (jobs[js.j_lastj] || js.j_lastj == old)    /* needed if old == js.j_jobslots */
     471            break;
     472          js.j_lastj--;
     473        }
     474@@ -963,7 +967,11 @@
     475   reap_dead_jobs ();
     476   realloc_jobs_list ();
     477 
     478-  return (js.j_lastj);
     479+#ifdef DEBUG
     480+  itrace("compact_jobs_list: returning %d", (js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
     481+#endif
     482+
     483+  return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0);
     484 }
     485 
     486 /* Delete the job at INDEX from the job list.  Must be called
     487@@ -984,8 +992,6 @@
    326488   temp = jobs[job_index];
    327489   if (temp == 0)
     
    332494   if ((dflags & DEL_NOBGPID) == 0)
    333495     {
    334 @@ -1028,6 +1026,9 @@
     496@@ -1028,6 +1034,9 @@
    335497     js.j_firstj = js.j_lastj = 0;
    336498   else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0)
     
    342504 
    343505 /* Must be called with SIGCHLD blocked. */
     506diff -Naur bash-3.2.orig/lib/readline/complete.c bash-3.2/lib/readline/complete.c
     507--- bash-3.2.orig/lib/readline/complete.c       2006-07-28 08:35:49.000000000 -0700
     508+++ bash-3.2/lib/readline/complete.c    2007-09-03 21:59:32.000000000 -0700
     509@@ -428,7 +428,7 @@
     510        return (1);
     511       if (c == 'n' || c == 'N' || c == RUBOUT)
     512        return (0);
     513-      if (c == ABORT_CHAR)
     514+      if (c == ABORT_CHAR || c < 0)
     515        _rl_abort_internal ();
     516       if (for_pager && (c == NEWLINE || c == RETURN))
     517        return (2);
    344518diff -Naur bash-3.2.orig/lib/readline/display.c bash-3.2/lib/readline/display.c
    345 --- bash-3.2.orig/lib/readline/display.c        2007-07-23 19:54:02.000000000 -0400
    346 +++ bash-3.2/lib/readline/display.c     2007-07-23 19:58:47.000000000 -0400
     519--- bash-3.2.orig/lib/readline/display.c        2006-09-14 11:20:12.000000000 -0700
     520+++ bash-3.2/lib/readline/display.c     2007-09-03 21:59:40.000000000 -0700
    347521@@ -561,6 +561,17 @@
    348522       wrap_offset = prompt_invis_chars_first_line = 0;
     
    371545 #if defined (HANDLE_MULTIBYTE)   
    372546 #define CHECK_LPOS() \
    373 @@ -1586,8 +1598,22 @@
     547@@ -1506,11 +1518,31 @@
     548     {
     549       /* Non-zero if we're increasing the number of lines. */
     550       int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
     551+      /* If col_lendiff is > 0, implying that the new string takes up more
     552+        screen real estate than the old, but lendiff is < 0, meaning that it
     553+        takes fewer bytes, we need to just output the characters starting
     554+        from the first difference.  These will overwrite what is on the
     555+        display, so there's no reason to do a smart update.  This can really
     556+        only happen in a multibyte environment. */
     557+      if (lendiff < 0)
     558+       {
     559+         _rl_output_some_chars (nfd, temp);
     560+         _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
     561+         /* If nfd begins before any invisible characters in the prompt,
     562+            adjust _rl_last_c_pos to account for wrap_offset and set
     563+            cpos_adjusted to let the caller know. */
     564+         if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
     565+           {
     566+             _rl_last_c_pos -= wrap_offset;
     567+             cpos_adjusted = 1;
     568+           }
     569+         return;
     570+       }
     571       /* Sometimes it is cheaper to print the characters rather than
     572         use the terminal's capabilities.  If we're growing the number
     573         of lines, make sure we actually cause the new line to wrap
     574         around on auto-wrapping terminals. */
     575-      if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
     576+      else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
     577        {
     578          /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
     579             _rl_horizontal_scroll_mode == 1, inserting the characters with
     580@@ -1586,8 +1618,22 @@
    374581          temp = nls - nfd;
    375582          if (temp > 0)
     
    395602        }
    396603       /* Otherwise, print over the existing material. */
    397 @@ -1595,8 +1621,20 @@
     604@@ -1595,8 +1641,20 @@
    398605        {
    399606          if (temp > 0)
     
    416623          lendiff = (oe - old) - (ne - new);
    417624          if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
    418 @@ -1732,7 +1770,10 @@
     625@@ -1732,7 +1790,10 @@
    419626   if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
    420627     {
     
    428635          dpos -= woff;
    429636          /* Since this will be assigned to _rl_last_c_pos at the end (more
    430 @@ -2380,6 +2421,8 @@
     637@@ -2380,6 +2441,8 @@
    431638 
    432639   if (end <= start)
     
    437644   memset (&ps, 0, sizeof (mbstate_t));
    438645 
     646diff -Naur bash-3.2.orig/lib/readline/input.c bash-3.2/lib/readline/input.c
     647--- bash-3.2.orig/lib/readline/input.c  2006-08-16 12:15:16.000000000 -0700
     648+++ bash-3.2/lib/readline/input.c       2007-09-03 21:59:42.000000000 -0700
     649@@ -133,8 +133,11 @@
     650     return (0);
     651 
     652   *key = ibuffer[pop_index++];
     653-
     654+#if 0
     655   if (pop_index >= ibuffer_len)
     656+#else
     657+  if (pop_index > ibuffer_len)
     658+#endif
     659     pop_index = 0;
     660 
     661   return (1);
     662@@ -250,7 +253,8 @@
     663       while (chars_avail--)
     664        {
     665          k = (*rl_getc_function) (rl_instream);
     666-         rl_stuff_char (k);
     667+         if (rl_stuff_char (k) == 0)
     668+           break;                      /* some problem; no more room */
     669          if (k == NEWLINE || k == RETURN)
     670            break;
     671        }
     672@@ -373,7 +377,11 @@
     673       RL_SETSTATE (RL_STATE_INPUTPENDING);
     674     }
     675   ibuffer[push_index++] = key;
     676+#if 0
     677   if (push_index >= ibuffer_len)
     678+#else
     679+  if (push_index > ibuffer_len)
     680+#endif
     681     push_index = 0;
     682 
     683   return 1;
     684@@ -513,20 +521,26 @@
     685      char *mbchar;
     686      int size;
     687 {
     688-  int mb_len = 0;
     689+  int mb_len, c;
     690   size_t mbchar_bytes_length;
     691   wchar_t wc;
     692   mbstate_t ps, ps_back;
     693 
     694   memset(&ps, 0, sizeof (mbstate_t));
     695   memset(&ps_back, 0, sizeof (mbstate_t));
     696
     697+
     698+  mb_len = 0; 
     699   while (mb_len < size)
     700     {
     701       RL_SETSTATE(RL_STATE_MOREINPUT);
     702-      mbchar[mb_len++] = rl_read_key ();
     703+      c = rl_read_key ();
     704       RL_UNSETSTATE(RL_STATE_MOREINPUT);
     705 
     706+      if (c < 0)
     707+       break;
     708+
     709+      mbchar[mb_len++] = c;
     710+
     711       mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
     712       if (mbchar_bytes_length == (size_t)(-1))
     713        break;          /* invalid byte sequence for the current locale */
     714@@ -564,7 +578,7 @@
     715 
     716   c = first;
     717   memset (mb, 0, mlen);
     718-  for (i = 0; i < mlen; i++)
     719+  for (i = 0; c >= 0 && i < mlen; i++)
     720     {
     721       mb[i] = (char)c;
     722       memset (&ps, 0, sizeof (mbstate_t));
     723diff -Naur bash-3.2.orig/lib/readline/isearch.c bash-3.2/lib/readline/isearch.c
     724--- bash-3.2.orig/lib/readline/isearch.c        2005-12-26 14:18:53.000000000 -0800
     725+++ bash-3.2/lib/readline/isearch.c     2007-09-03 21:59:32.000000000 -0700
     726@@ -327,8 +327,15 @@
     727   rl_command_func_t *f;
     728 
     729   f = (rl_command_func_t *)NULL;
     730-
     731- /* Translate the keys we do something with to opcodes. */
     732+
     733+  if (c < 0)
     734+    {
     735+      cxt->sflags |= SF_FAILED;
     736+      cxt->history_pos = cxt->last_found_line;
     737+      return -1;
     738+    }
     739+
     740+  /* Translate the keys we do something with to opcodes. */
     741   if (c >= 0 && _rl_keymap[c].type == ISFUNC)
     742     {
     743       f = _rl_keymap[c].function;
     744diff -Naur bash-3.2.orig/lib/readline/misc.c bash-3.2/lib/readline/misc.c
     745--- bash-3.2.orig/lib/readline/misc.c   2005-12-26 14:20:46.000000000 -0800
     746+++ bash-3.2/lib/readline/misc.c        2007-09-03 21:59:32.000000000 -0700
     747@@ -146,6 +146,8 @@
     748          rl_restore_prompt ();
     749          rl_clear_message ();
     750          RL_UNSETSTATE(RL_STATE_NUMERICARG);
     751+         if (key < 0)
     752+           return -1;
     753          return (_rl_dispatch (key, _rl_keymap));
     754        }
     755     }
     756diff -Naur bash-3.2.orig/lib/readline/readline.c bash-3.2/lib/readline/readline.c
     757--- bash-3.2.orig/lib/readline/readline.c       2006-08-16 12:00:36.000000000 -0700
     758+++ bash-3.2/lib/readline/readline.c    2007-09-03 21:59:32.000000000 -0700
     759@@ -645,6 +645,11 @@
     760   if ((cxt->flags & KSEQ_DISPATCHED) == 0)
     761     {
     762       nkey = _rl_subseq_getchar (cxt->okey);
     763+      if (nkey < 0)
     764+       {
     765+         _rl_abort_internal ();
     766+         return -1;
     767+       }
     768       r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
     769       cxt->flags |= KSEQ_DISPATCHED;
     770     }
     771diff -Naur bash-3.2.orig/lib/readline/text.c bash-3.2/lib/readline/text.c
     772--- bash-3.2.orig/lib/readline/text.c   2006-07-28 08:55:27.000000000 -0700
     773+++ bash-3.2/lib/readline/text.c        2007-09-03 21:59:32.000000000 -0700
     774@@ -857,6 +857,9 @@
     775   c = rl_read_key ();
     776   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     777 
     778+  if (c < 0)
     779+    return -1;
     780+
     781 #if defined (HANDLE_SIGNALS)
     782   if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
     783     _rl_restore_tty_signals ();
     784@@ -1520,6 +1523,9 @@
     785 
     786   mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
     787 
     788+  if (mb_len <= 0)
     789+    return -1;
     790+
     791   if (count < 0)
     792     return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
     793   else
     794@@ -1536,6 +1542,9 @@
     795   c = rl_read_key ();
     796   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     797 
     798+  if (c < 0)
     799+    return -1;
     800+
     801   if (count < 0)
     802     return (_rl_char_search_internal (-count, bdir, c));
     803   else
     804diff -Naur bash-3.2.orig/lib/readline/vi_mode.c bash-3.2/lib/readline/vi_mode.c
     805--- bash-3.2.orig/lib/readline/vi_mode.c        2006-07-29 13:42:28.000000000 -0700
     806+++ bash-3.2/lib/readline/vi_mode.c     2007-09-03 21:59:32.000000000 -0700
     807@@ -886,6 +886,13 @@
     808   RL_SETSTATE(RL_STATE_MOREINPUT);
     809   c = rl_read_key ();
     810   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     811+
     812+  if (c < 0)
     813+    {
     814+      *nextkey = 0;
     815+      return -1;
     816+    }
     817+
     818   *nextkey = c;
     819 
     820   if (!member (c, vi_motion))
     821@@ -902,6 +909,11 @@
     822          RL_SETSTATE(RL_STATE_MOREINPUT);
     823          c = rl_read_key ();   /* real command */
     824          RL_UNSETSTATE(RL_STATE_MOREINPUT);
     825+         if (c < 0)
     826+           {
     827+             *nextkey = 0;
     828+             return -1;
     829+           }
     830          *nextkey = c;
     831        }
     832       else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
     833@@ -1224,14 +1236,22 @@
     834 _rl_vi_callback_char_search (data)
     835      _rl_callback_generic_arg *data;
     836 {
     837+  int c;
     838 #if defined (HANDLE_MULTIBYTE)
     839-  _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
     840+  c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
     841 #else
     842   RL_SETSTATE(RL_STATE_MOREINPUT);
     843-  _rl_vi_last_search_char = rl_read_key ();
     844+  c = rl_read_key ();
     845   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     846 #endif
     847 
     848+  if (c <= 0)
     849+    return -1;
     850+
     851+#if !defined (HANDLE_MULTIBYTE)
     852+  _rl_vi_last_search_char = c;
     853+#endif
     854+
     855   _rl_callback_func = 0;
     856   _rl_want_redisplay = 1;
     857 
     858@@ -1247,6 +1267,7 @@
     859 rl_vi_char_search (count, key)
     860      int count, key;
     861 {
     862+  int c;
     863 #if defined (HANDLE_MULTIBYTE)
     864   static char *target;
     865   static int tlen;
     866@@ -1293,11 +1314,17 @@
     867       else
     868        {
     869 #if defined (HANDLE_MULTIBYTE)
     870-         _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
     871+         c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
     872+         if (c <= 0)
     873+           return -1;
     874+         _rl_vi_last_search_mblen = c;
     875 #else
     876          RL_SETSTATE(RL_STATE_MOREINPUT);
     877-         _rl_vi_last_search_char = rl_read_key ();
     878+         c = rl_read_key ();
     879          RL_UNSETSTATE(RL_STATE_MOREINPUT);
     880+         if (c < 0)
     881+           return -1;
     882+         _rl_vi_last_search_char = c;
     883 #endif
     884        }
     885     }
     886@@ -1467,6 +1494,9 @@
     887   c = rl_read_key ();
     888   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     889 
     890+  if (c < 0)
     891+    return -1;
     892+
     893 #if defined (HANDLE_MULTIBYTE)
     894   if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
     895     c = _rl_read_mbstring (c, mb, mlen);
     896@@ -1485,6 +1515,9 @@
     897 
     898   _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
     899 
     900+  if (c < 0)
     901+    return -1;
     902+
     903   _rl_callback_func = 0;
     904   _rl_want_redisplay = 1;
     905 
     906@@ -1516,6 +1549,9 @@
     907   else
     908     _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
     909 
     910+  if (c < 0)
     911+    return -1;
     912+
     913   return (_rl_vi_change_char (count, c, mb));
     914 }
     915 
     916@@ -1650,7 +1686,7 @@
     917   ch = rl_read_key ();
     918   RL_UNSETSTATE(RL_STATE_MOREINPUT);
     919 
     920-  if (ch < 'a' || ch > 'z')
     921+  if (ch < 0 || ch < 'a' || ch > 'z')  /* make test against 0 explicit */
     922     {
     923       rl_ding ();
     924       return -1;
     925@@ -1702,7 +1738,7 @@
     926       rl_point = rl_mark;
     927       return 0;
     928     }
     929-  else if (ch < 'a' || ch > 'z')
     930+  else if (ch < 0 || ch < 'a' || ch > 'z')     /* make test against 0 explicit */
     931     {
     932       rl_ding ();
     933       return -1;
    439934diff -Naur bash-3.2.orig/lib/sh/snprintf.c bash-3.2/lib/sh/snprintf.c
    440 --- bash-3.2.orig/lib/sh/snprintf.c     2007-07-23 19:54:02.000000000 -0400
    441 +++ bash-3.2/lib/sh/snprintf.c  2007-07-23 19:58:47.000000000 -0400
     935--- bash-3.2.orig/lib/sh/snprintf.c     2006-04-06 06:48:40.000000000 -0700
     936+++ bash-3.2/lib/sh/snprintf.c  2007-09-03 21:59:19.000000000 -0700
    442937@@ -471,6 +471,8 @@
    443938          10^x ~= r
     
    5671062                 * is in the range or [-4,p] exclusively
    5681063diff -Naur bash-3.2.orig/parse.y bash-3.2/parse.y
    569 --- bash-3.2.orig/parse.y       2007-07-23 19:54:02.000000000 -0400
    570 +++ bash-3.2/parse.y    2007-07-23 19:58:47.000000000 -0400
     1064--- bash-3.2.orig/parse.y       2006-09-19 13:37:21.000000000 -0700
     1065+++ bash-3.2/parse.y    2007-09-03 21:59:35.000000000 -0700
    5711066@@ -1029,6 +1029,7 @@
    5721067 #define PST_CMDTOKEN   0x1000          /* command token OK - unused */
     
    6261121        {
    6271122          tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
     1123@@ -3367,7 +3376,7 @@
     1124       if (pass_next_character)
     1125        {
     1126          pass_next_character = 0;
     1127-         goto got_character;
     1128+         goto got_escaped_character;
     1129        }
     1130 
     1131       cd = current_delimiter (dstack);
    6281132@@ -3419,9 +3428,34 @@
    6291133          goto next_character;
     
    6621166          peek_char = shell_getc (1);
    6631167          if MBTEST(peek_char == '(')           /* ) */
     1168@@ -3616,12 +3650,14 @@
     1169 
     1170     got_character:
     1171 
     1172-      all_digit_token &= DIGIT (character);
     1173-      dollar_present |= character == '$';
     1174-
     1175       if (character == CTLESC || character == CTLNUL)
     1176        token[token_index++] = CTLESC;
     1177 
     1178+    got_escaped_character:
     1179+
     1180+      all_digit_token &= DIGIT (character);
     1181+      dollar_present |= character == '$';
     1182+
     1183       token[token_index++] = character;
     1184 
     1185       RESIZE_MALLOCED_BUFFER (token, token_index, 1, token_buffer_size,
    6641186diff -Naur bash-3.2.orig/patchlevel.h bash-3.2/patchlevel.h
    665 --- bash-3.2.orig/patchlevel.h  2007-07-23 19:54:02.000000000 -0400
    666 +++ bash-3.2/patchlevel.h       2007-07-23 19:58:47.000000000 -0400
     1187--- bash-3.2.orig/patchlevel.h  2006-04-13 05:31:04.000000000 -0700
     1188+++ bash-3.2/patchlevel.h       2007-09-03 21:59:42.000000000 -0700
    6671189@@ -25,6 +25,6 @@
    6681190    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
     
    6701192 
    6711193-#define PATCHLEVEL 0
    672 +#define PATCHLEVEL 17
     1194+#define PATCHLEVEL 25
    6731195 
    6741196 #endif /* _PATCHLEVEL_H_ */
    6751197diff -Naur bash-3.2.orig/pathexp.c bash-3.2/pathexp.c
    676 --- bash-3.2.orig/pathexp.c     2007-07-23 19:54:02.000000000 -0400
    677 +++ bash-3.2/pathexp.c  2007-07-23 19:58:47.000000000 -0400
     1198--- bash-3.2.orig/pathexp.c     2002-05-06 10:43:05.000000000 -0700
     1199+++ bash-3.2/pathexp.c  2007-09-03 21:59:21.000000000 -0700
    6781200@@ -1,6 +1,6 @@
    6791201 /* pathexp.c -- The shell interface to the globbing library. */
     
    7281250          if (pathname[i] == '\0')
    7291251diff -Naur bash-3.2.orig/pathexp.h bash-3.2/pathexp.h
    730 --- bash-3.2.orig/pathexp.h     2007-07-23 19:54:02.000000000 -0400
    731 +++ bash-3.2/pathexp.h  2007-07-23 19:58:47.000000000 -0400
     1252--- bash-3.2.orig/pathexp.h     2005-02-19 14:23:18.000000000 -0800
     1253+++ bash-3.2/pathexp.h  2007-09-03 21:59:21.000000000 -0700
    7321254@@ -1,6 +1,6 @@
    7331255 /* pathexp.h -- The shell interface to the globbing library. */
     
    7471269 /* Flags to OR with other flag args to strmatch() to enabled the extended
    7481270diff -Naur bash-3.2.orig/po/ru.po bash-3.2/po/ru.po
    749 --- bash-3.2.orig/po/ru.po      2007-07-23 19:54:02.000000000 -0400
    750 +++ bash-3.2/po/ru.po   2007-07-23 19:58:47.000000000 -0400
     1271--- bash-3.2.orig/po/ru.po      2006-01-10 14:51:03.000000000 -0800
     1272+++ bash-3.2/po/ru.po   2007-09-03 21:59:10.000000000 -0700
    7511273@@ -12,7 +12,7 @@
    7521274 "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n"
     
    7581280 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
    7591281 
     1282diff -Naur bash-3.2.orig/sig.c bash-3.2/sig.c
     1283--- bash-3.2.orig/sig.c 2006-01-25 11:57:59.000000000 -0800
     1284+++ bash-3.2/sig.c      2007-09-03 21:59:34.000000000 -0700
     1285@@ -350,6 +350,25 @@
     1286 #undef XSIG
     1287 #undef XHANDLER
     1288 
     1289+/* Run some of the cleanups that should be performed when we run
     1290+   jump_to_top_level from a builtin command context.  XXX - might want to
     1291+   also call reset_parser here. */
     1292+void
     1293+top_level_cleanup ()
     1294+{
     1295+  /* Clean up string parser environment. */
     1296+  while (parse_and_execute_level)
     1297+    parse_and_execute_cleanup ();
     1298+
     1299+#if defined (PROCESS_SUBSTITUTION)
     1300+  unlink_fifo_list ();
     1301+#endif /* PROCESS_SUBSTITUTION */
     1302+
     1303+  run_unwind_protects ();
     1304+  loop_level = continuing = breaking = 0;
     1305+  return_catch_flag = 0;
     1306+}
     1307+
     1308 /* What to do when we've been interrupted, and it is safe to handle it. */
     1309 void
     1310 throw_to_top_level ()
     1311diff -Naur bash-3.2.orig/sig.h bash-3.2/sig.h
     1312--- bash-3.2.orig/sig.h 2006-01-25 11:50:27.000000000 -0800
     1313+++ bash-3.2/sig.h      2007-09-03 21:59:34.000000000 -0700
     1314@@ -121,6 +121,7 @@
     1315 extern void initialize_signals __P((int));
     1316 extern void initialize_terminating_signals __P((void));
     1317 extern void reset_terminating_signals __P((void));
     1318+extern void top_level_cleanup __P((void));
     1319 extern void throw_to_top_level __P((void));
     1320 extern void jump_to_top_level __P((int)) __attribute__((__noreturn__));
     1321 
    7601322diff -Naur bash-3.2.orig/subst.c bash-3.2/subst.c
    761 --- bash-3.2.orig/subst.c       2007-07-23 19:54:02.000000000 -0400
    762 +++ bash-3.2/subst.c    2007-07-23 19:58:47.000000000 -0400
     1323--- bash-3.2.orig/subst.c       2006-09-19 05:35:09.000000000 -0700
     1324+++ bash-3.2/subst.c    2007-09-03 21:59:37.000000000 -0700
    7631325@@ -4,7 +4,7 @@
    7641326 /* ``Have a little faith, there's magic in the night.  You ain't a
     
    7701332    This file is part of GNU Bash, the Bourne Again SHell.
    7711333 
     1334@@ -1278,7 +1278,7 @@
     1335     {
     1336       if (no_longjmp_on_fatal_error == 0)
     1337        {                       /* { */
     1338-         report_error ("bad substitution: no closing `%s' in %s", "}", string);
     1339+         report_error (_("bad substitution: no closing `%s' in %s"), "}", string);
     1340          last_command_exit_value = EXECUTION_FAILURE;
     1341          exp_jump_to_top_level (DISCARD);
     1342        }
    7721343@@ -1887,7 +1887,13 @@
    7731344   sep[1] = '\0';
     
    8771448          s++;
    8781449          if (*s == '\0')
    879 @@ -4123,6 +4143,12 @@
     1450@@ -3954,7 +3974,11 @@
     1451   if (patspec == RP_LONG_LEFT || patspec == RP_LONG_RIGHT)
     1452     patstr++;
     1453 
     1454-  pattern = getpattern (patstr, quoted, 1);
     1455+  /* Need to pass getpattern newly-allocated memory in case of expansion --
     1456+     the expansion code will free the passed string on an error. */
     1457+  temp1 = savestring (patstr);
     1458+  pattern = getpattern (temp1, quoted, 1);
     1459+  free (temp1);
     1460 
     1461   temp1 = (char *)NULL;                /* shut up gcc */
     1462   switch (vtype)
     1463@@ -4123,6 +4147,12 @@
    8801464     nfifo = 0;
    8811465 }
     
    8901474 make_named_pipe ()
    8911475 {
    892 @@ -4172,6 +4198,12 @@
     1476@@ -4172,6 +4202,12 @@
    8931477   nfds++;
    8941478 }
     
    9031487 unlink_fifo_list ()
    9041488 {
    905 @@ -4456,7 +4488,15 @@
     1489@@ -4456,7 +4492,15 @@
    9061490       /* Add the character to ISTRING, possibly after resizing it. */
    9071491       RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
     
    9201504 
    9211505       istring[istring_index++] = c;
    922 @@ -4665,6 +4705,9 @@
     1506@@ -4665,6 +4709,9 @@
    9231507 
    9241508       last_command_exit_value = rc;
     
    9301514     }
    9311515   else
    932 @@ -5546,12 +5589,16 @@
     1516@@ -5546,12 +5593,16 @@
    9331517         so verify_substring_values just returns the numbers specified and we
    9341518         rely on array_subrange to understand how to deal with them). */
     
    9471531       break;
    9481532 #endif
    949 @@ -5707,6 +5754,11 @@
     1533@@ -5707,6 +5758,11 @@
    9501534   vtype &= ~VT_STARSUB;
    9511535 
     
    9591543   /* Malloc this because expand_string_if_necessary or one of the expansion
    9601544      functions in its call chain may free it on a substitution error. */
    961 @@ -5741,13 +5793,12 @@
     1545@@ -5741,13 +5797,12 @@
    9621546     }
    9631547 
     
    9781562     {
    9791563       mflags |= MATCH_BEG;
    980 @@ -5798,12 +5849,16 @@
     1564@@ -5798,12 +5853,16 @@
    9811565 #if defined (ARRAY_VARS)
    9821566     case VT_ARRAYVAR:
     
    9951579 #endif
    9961580     }
     1581@@ -7607,6 +7666,8 @@
     1582   expand_no_split_dollar_star = 0;     /* XXX */
     1583   expanding_redir = 0;
     1584 
     1585+  top_level_cleanup ();                        /* from sig.c */
     1586+
     1587   jump_to_top_level (v);
     1588 }
     1589 
     1590@@ -7824,7 +7885,7 @@
     1591          else if (fail_glob_expansion != 0)
     1592            {
     1593              report_error (_("no match: %s"), tlist->word->word);
     1594-             jump_to_top_level (DISCARD);
     1595+             exp_jump_to_top_level (DISCARD);
     1596            }
     1597          else if (allow_null_glob_expansion == 0)
     1598            {
    9971599diff -Naur bash-3.2.orig/subst.h bash-3.2/subst.h
    998 --- bash-3.2.orig/subst.h       2007-07-23 19:54:02.000000000 -0400
    999 +++ bash-3.2/subst.h    2007-07-23 19:58:47.000000000 -0400
     1600--- bash-3.2.orig/subst.h       2006-09-19 05:34:41.000000000 -0700
     1601+++ bash-3.2/subst.h    2007-09-03 21:59:26.000000000 -0700
    10001602@@ -222,6 +222,7 @@
    10011603 extern char *command_substitute __P((char *, int));
     
    10071609 extern WORD_LIST *list_string_with_quotes __P((char *));
    10081610diff -Naur bash-3.2.orig/tests/new-exp.right bash-3.2/tests/new-exp.right
    1009 --- bash-3.2.orig/tests/new-exp.right   2007-07-23 19:54:02.000000000 -0400
    1010 +++ bash-3.2/tests/new-exp.right        2007-07-23 19:58:47.000000000 -0400
     1611--- bash-3.2.orig/tests/new-exp.right   2006-08-10 09:00:00.000000000 -0700
     1612+++ bash-3.2/tests/new-exp.right        2007-09-03 21:59:12.000000000 -0700
    10111613@@ -430,7 +430,7 @@
    10121614 Case06---1---A B C::---
     
    10181620 argv[2] = <b>
    10191621 argv[3] = <c>
     1622diff -Naur bash-3.2.orig/variables.c bash-3.2/variables.c
     1623--- bash-3.2.orig/variables.c   2006-09-08 10:33:32.000000000 -0700
     1624+++ bash-3.2/variables.c        2007-09-03 21:59:34.000000000 -0700
     1625@@ -1821,11 +1821,17 @@
     1626          oval = value_cell (var);
     1627          lval = evalexp (oval, &expok);        /* ksh93 seems to do this */
     1628          if (expok == 0)
     1629-           jump_to_top_level (DISCARD);
     1630+           {
     1631+             top_level_cleanup ();
     1632+             jump_to_top_level (DISCARD);
     1633+           }
     1634        }
     1635       rval = evalexp (value, &expok);
     1636       if (expok == 0)
     1637-       jump_to_top_level (DISCARD);
     1638+       {
     1639+         top_level_cleanup ();
     1640+         jump_to_top_level (DISCARD);
     1641+       }
     1642       if (flags & ASS_APPEND)
     1643        rval += lval;
     1644       retval = itos (rval);
Note: See TracChangeset for help on using the changeset viewer.