- Timestamp:
- Sep 3, 2007, 10:04:12 PM (17 years ago)
- Branches:
- clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 37da1a9
- Parents:
- 91e274a
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
patches/bash-3.2-fixes-6.patch
r91e274a r5cd07a2 1 Submitted By: J oe Ciccone <jciccone@gmail.com>2 Date: 2007-0 7-231 Submitted By: Jim Gifford (jim at linuxfromscratch dot org) 2 Date: 2007-09-04 3 3 Initial Package Version: 3.2 4 4 Origin: ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/ 5 5 Upstream Status: From Upstream 6 Description: Contains patches 001-0 17from upstream6 Description: Contains patches 001-025 from upstream 7 7 8 8 diff -Naur bash-3.2.orig/array.c bash-3.2/array.c 9 --- bash-3.2.orig/array.c 200 7-07-23 19:54:02.000000000 -040010 +++ bash-3.2/array.c 2007-0 7-23 19:58:47.000000000 -04009 --- 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 11 11 @@ -120,7 +120,6 @@ 12 12 return(a1); … … 106 106 sifs[0] = ifs ? *ifs : '\0'; 107 107 diff -Naur bash-3.2.orig/array.h bash-3.2/array.h 108 --- bash-3.2.orig/array.h 200 7-07-23 19:54:02.000000000 -0400109 +++ bash-3.2/array.h 2007-0 7-23 19:58:47.000000000 -0400108 --- 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 110 110 @@ -55,6 +55,7 @@ 111 111 extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *)); … … 116 116 extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int)); 117 117 extern char *array_patsub __P((ARRAY *, char *, char *, int)); 118 diff -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; 118 130 diff -Naur bash-3.2.orig/builtins/common.c bash-3.2/builtins/common.c 119 --- bash-3.2.orig/builtins/common.c 200 7-07-23 19:54:02.000000000 -0400120 +++ bash-3.2/builtins/common.c 2007-0 7-23 19:58:47.000000000 -0400131 --- 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 121 133 @@ -1,4 +1,4 @@ 122 134 -/* Copyright (C) 1987-2005 Free Software Foundation, Inc. … … 125 137 This file is part of GNU Bash, the Bourne Again SHell. 126 138 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 @@ 128 160 129 161 if (the_current_working_directory == 0) … … 138 170 fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"), 139 171 diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def 140 --- bash-3.2.orig/builtins/printf.def 200 7-07-23 19:54:02.000000000 -0400141 +++ bash-3.2/builtins/printf.def 2007-0 7-23 19:58:47.000000000 -0400172 --- 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 142 174 @@ -1,7 +1,7 @@ 143 175 This file is printf.def, from which is created printf.c. … … 184 216 static int printstr __P((char *, char *, int, int, int)); 185 217 static int tescape __P((char *, char *, int *)); 218 diff -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; 186 294 diff -Naur bash-3.2.orig/config-bot.h bash-3.2/config-bot.h 187 --- bash-3.2.orig/config-bot.h 200 7-07-23 19:54:02.000000000 -0400188 +++ bash-3.2/config-bot.h 2007-0 7-23 19:58:47.000000000 -0400295 --- 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 189 297 @@ -1,7 +1,7 @@ 190 298 /* config-bot.h */ … … 212 320 213 321 diff -Naur bash-3.2.orig/config.h.in bash-3.2/config.h.in 214 --- bash-3.2.orig/config.h.in 200 7-07-23 19:54:02.000000000 -0400215 +++ bash-3.2/config.h.in 2007-0 7-23 19:58:47.000000000 -0400322 --- 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 216 324 @@ -1,6 +1,6 @@ 217 325 /* config.h -- Configuration file for bash. */ … … 242 350 243 351 diff -Naur bash-3.2.orig/configure bash-3.2/configure 244 --- bash-3.2.orig/configure 200 7-07-23 19:54:02.000000000 -0400245 +++ bash-3.2/configure 2007-0 7-23 19:58:47.000000000 -0400352 --- 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 246 354 @@ -27316,7 +27316,8 @@ 247 355 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;; … … 255 363 case "`uname -r`" in 256 364 diff -Naur bash-3.2.orig/configure.in bash-3.2/configure.in 257 --- bash-3.2.orig/configure.in 200 7-07-23 19:54:02.000000000 -0400258 +++ bash-3.2/configure.in 2007-0 7-23 19:58:47.000000000 -0400365 --- 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 259 367 @@ -5,7 +5,7 @@ 260 368 dnl … … 277 385 case "`uname -r`" in 278 386 diff -Naur bash-3.2.orig/execute_cmd.c bash-3.2/execute_cmd.c 279 --- bash-3.2.orig/execute_cmd.c 200 7-07-23 19:54:02.000000000 -0400280 +++ bash-3.2/execute_cmd.c 2007-0 7-23 19:58:47.000000000 -0400387 --- 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 281 389 @@ -1,6 +1,6 @@ 282 390 /* execute_cmd.c -- Execute a COMMAND structure. */ … … 308 416 pipe_in, pipe_out, async, fds_to_close, 309 417 simple_command->flags); 418 diff -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 310 429 diff -Naur bash-3.2.orig/findcmd.c bash-3.2/findcmd.c 311 --- bash-3.2.orig/findcmd.c 200 7-07-23 19:54:02.000000000 -0400312 +++ bash-3.2/findcmd.c 2007-0 7-23 19:58:47.000000000 -0400430 --- 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 313 432 @@ -308,7 +308,7 @@ 314 433 if (hashed_file && (posixly_correct || check_hashed_filenames)) … … 321 440 free (hashed_file); 322 441 diff -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 @@ 326 488 temp = jobs[job_index]; 327 489 if (temp == 0) … … 332 494 if ((dflags & DEL_NOBGPID) == 0) 333 495 { 334 @@ -1028,6 +10 26,9 @@496 @@ -1028,6 +1034,9 @@ 335 497 js.j_firstj = js.j_lastj = 0; 336 498 else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0) … … 342 504 343 505 /* Must be called with SIGCHLD blocked. */ 506 diff -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); 344 518 diff -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 200 7-07-23 19:54:02.000000000 -0400346 +++ bash-3.2/lib/readline/display.c 2007-0 7-23 19:58:47.000000000 -0400519 --- 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 347 521 @@ -561,6 +561,17 @@ 348 522 wrap_offset = prompt_invis_chars_first_line = 0; … … 371 545 #if defined (HANDLE_MULTIBYTE) 372 546 #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 @@ 374 581 temp = nls - nfd; 375 582 if (temp > 0) … … 395 602 } 396 603 /* Otherwise, print over the existing material. */ 397 @@ -1595,8 +16 21,20 @@604 @@ -1595,8 +1641,20 @@ 398 605 { 399 606 if (temp > 0) … … 416 623 lendiff = (oe - old) - (ne - new); 417 624 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 418 @@ -1732,7 +17 70,10 @@625 @@ -1732,7 +1790,10 @@ 419 626 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 420 627 { … … 428 635 dpos -= woff; 429 636 /* Since this will be assigned to _rl_last_c_pos at the end (more 430 @@ -2380,6 +24 21,8 @@637 @@ -2380,6 +2441,8 @@ 431 638 432 639 if (end <= start) … … 437 644 memset (&ps, 0, sizeof (mbstate_t)); 438 645 646 diff -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)); 723 diff -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; 744 diff -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 } 756 diff -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 } 771 diff -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 804 diff -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; 439 934 diff -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 200 7-07-23 19:54:02.000000000 -0400441 +++ bash-3.2/lib/sh/snprintf.c 2007-0 7-23 19:58:47.000000000 -0400935 --- 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 442 937 @@ -471,6 +471,8 @@ 443 938 10^x ~= r … … 567 1062 * is in the range or [-4,p] exclusively 568 1063 diff -Naur bash-3.2.orig/parse.y bash-3.2/parse.y 569 --- bash-3.2.orig/parse.y 200 7-07-23 19:54:02.000000000 -0400570 +++ bash-3.2/parse.y 2007-0 7-23 19:58:47.000000000 -04001064 --- 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 571 1066 @@ -1029,6 +1029,7 @@ 572 1067 #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ … … 626 1121 { 627 1122 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); 628 1132 @@ -3419,9 +3428,34 @@ 629 1133 goto next_character; … … 662 1166 peek_char = shell_getc (1); 663 1167 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, 664 1186 diff -Naur bash-3.2.orig/patchlevel.h bash-3.2/patchlevel.h 665 --- bash-3.2.orig/patchlevel.h 200 7-07-23 19:54:02.000000000 -0400666 +++ bash-3.2/patchlevel.h 2007-0 7-23 19:58:47.000000000 -04001187 --- 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 667 1189 @@ -25,6 +25,6 @@ 668 1190 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh … … 670 1192 671 1193 -#define PATCHLEVEL 0 672 +#define PATCHLEVEL 171194 +#define PATCHLEVEL 25 673 1195 674 1196 #endif /* _PATCHLEVEL_H_ */ 675 1197 diff -Naur bash-3.2.orig/pathexp.c bash-3.2/pathexp.c 676 --- bash-3.2.orig/pathexp.c 200 7-07-23 19:54:02.000000000 -0400677 +++ bash-3.2/pathexp.c 2007-0 7-23 19:58:47.000000000 -04001198 --- 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 678 1200 @@ -1,6 +1,6 @@ 679 1201 /* pathexp.c -- The shell interface to the globbing library. */ … … 728 1250 if (pathname[i] == '\0') 729 1251 diff -Naur bash-3.2.orig/pathexp.h bash-3.2/pathexp.h 730 --- bash-3.2.orig/pathexp.h 200 7-07-23 19:54:02.000000000 -0400731 +++ bash-3.2/pathexp.h 2007-0 7-23 19:58:47.000000000 -04001252 --- 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 732 1254 @@ -1,6 +1,6 @@ 733 1255 /* pathexp.h -- The shell interface to the globbing library. */ … … 747 1269 /* Flags to OR with other flag args to strmatch() to enabled the extended 748 1270 diff -Naur bash-3.2.orig/po/ru.po bash-3.2/po/ru.po 749 --- bash-3.2.orig/po/ru.po 200 7-07-23 19:54:02.000000000 -0400750 +++ bash-3.2/po/ru.po 2007-0 7-23 19:58:47.000000000 -04001271 --- 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 751 1273 @@ -12,7 +12,7 @@ 752 1274 "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n" … … 758 1280 "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" 759 1281 1282 diff -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 () 1311 diff -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 760 1322 diff -Naur bash-3.2.orig/subst.c bash-3.2/subst.c 761 --- bash-3.2.orig/subst.c 200 7-07-23 19:54:02.000000000 -0400762 +++ bash-3.2/subst.c 2007-0 7-23 19:58:47.000000000 -04001323 --- 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 763 1325 @@ -4,7 +4,7 @@ 764 1326 /* ``Have a little faith, there's magic in the night. You ain't a … … 770 1332 This file is part of GNU Bash, the Bourne Again SHell. 771 1333 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 } 772 1343 @@ -1887,7 +1887,13 @@ 773 1344 sep[1] = '\0'; … … 877 1448 s++; 878 1449 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 @@ 880 1464 nfifo = 0; 881 1465 } … … 890 1474 make_named_pipe () 891 1475 { 892 @@ -4172,6 +4 198,12 @@1476 @@ -4172,6 +4202,12 @@ 893 1477 nfds++; 894 1478 } … … 903 1487 unlink_fifo_list () 904 1488 { 905 @@ -4456,7 +44 88,15 @@1489 @@ -4456,7 +4492,15 @@ 906 1490 /* Add the character to ISTRING, possibly after resizing it. */ 907 1491 RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE); … … 920 1504 921 1505 istring[istring_index++] = c; 922 @@ -4665,6 +470 5,9 @@1506 @@ -4665,6 +4709,9 @@ 923 1507 924 1508 last_command_exit_value = rc; … … 930 1514 } 931 1515 else 932 @@ -5546,12 +55 89,16 @@1516 @@ -5546,12 +5593,16 @@ 933 1517 so verify_substring_values just returns the numbers specified and we 934 1518 rely on array_subrange to understand how to deal with them). */ … … 947 1531 break; 948 1532 #endif 949 @@ -5707,6 +575 4,11 @@1533 @@ -5707,6 +5758,11 @@ 950 1534 vtype &= ~VT_STARSUB; 951 1535 … … 959 1543 /* Malloc this because expand_string_if_necessary or one of the expansion 960 1544 functions in its call chain may free it on a substitution error. */ 961 @@ -5741,13 +579 3,12 @@1545 @@ -5741,13 +5797,12 @@ 962 1546 } 963 1547 … … 978 1562 { 979 1563 mflags |= MATCH_BEG; 980 @@ -5798,12 +58 49,16 @@1564 @@ -5798,12 +5853,16 @@ 981 1565 #if defined (ARRAY_VARS) 982 1566 case VT_ARRAYVAR: … … 995 1579 #endif 996 1580 } 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 { 997 1599 diff -Naur bash-3.2.orig/subst.h bash-3.2/subst.h 998 --- bash-3.2.orig/subst.h 200 7-07-23 19:54:02.000000000 -0400999 +++ bash-3.2/subst.h 2007-0 7-23 19:58:47.000000000 -04001600 --- 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 1000 1602 @@ -222,6 +222,7 @@ 1001 1603 extern char *command_substitute __P((char *, int)); … … 1007 1609 extern WORD_LIST *list_string_with_quotes __P((char *)); 1008 1610 diff -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 200 7-07-23 19:54:02.000000000 -04001010 +++ bash-3.2/tests/new-exp.right 2007-0 7-23 19:58:47.000000000 -04001611 --- 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 1011 1613 @@ -430,7 +430,7 @@ 1012 1614 Case06---1---A B C::--- … … 1018 1620 argv[2] = <b> 1019 1621 argv[3] = <c> 1622 diff -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.