source:
patches/bash-3.2-fixes-6.patch@
c814e64
Last change on this file since c814e64 was 5cd07a2, checked in by , 17 years ago | |
---|---|
|
|
File size: 49.2 KB |
-
array.c
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 2007-09-04 Initial Package Version: 3.2 Origin: ftp://ftp.cwru.edu/pub/bash/bash-3.2-patches/ Upstream Status: From Upstream Description: Contains patches 001-025 from upstream diff -Naur bash-3.2.orig/array.c bash-3.2/array.c
old new 120 120 return(a1); 121 121 } 122 122 123 #ifdef INCLUDE_UNUSED124 123 /* 125 124 * Make and return a new array composed of the elements in array A from 126 125 * S to E, inclusive. … … 141 140 for (p = s, i = 0; p != e; p = element_forw(p), i++) { 142 141 n = array_create_element (element_index(p), element_value(p)); 143 142 ADD_BEFORE(a->head, n); 144 mi = element_index( ae);143 mi = element_index(n); 145 144 } 146 145 a->num_elements = i; 147 146 a->max_index = mi; 148 147 return a; 149 148 } 150 #endif151 149 152 150 /* 153 151 * Walk the array, calling FUNC once for each element, with the array … … 300 298 return array; 301 299 } 302 300 301 ARRAY * 302 array_quote_escapes(array) 303 ARRAY *array; 304 { 305 ARRAY_ELEMENT *a; 306 char *t; 307 308 if (array == 0 || array_head(array) == 0 || array_empty(array)) 309 return (ARRAY *)NULL; 310 for (a = element_forw(array->head); a != array->head; a = element_forw(a)) { 311 t = quote_escapes (a->value); 312 FREE(a->value); 313 a->value = t; 314 } 315 return array; 316 } 317 303 318 /* 304 319 * Return a string whose elements are the members of array A beginning at 305 320 * index START and spanning NELEM members. Null elements are counted. … … 311 326 arrayind_t start, nelem; 312 327 int starsub, quoted; 313 328 { 329 ARRAY *a2; 314 330 ARRAY_ELEMENT *h, *p; 315 331 arrayind_t i; 316 char *ifs, sep[2] ;332 char *ifs, sep[2], *t; 317 333 318 334 p = a ? array_head (a) : 0; 319 335 if (p == 0 || array_empty (a) || start > array_max_index(a)) … … 336 352 for (i = 0, h = p; p != a->head && i < nelem; i++, p = element_forw(p)) 337 353 ; 338 354 355 a2 = array_slice(a, h, p); 356 357 if (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) 358 array_quote(a2); 359 else 360 array_quote_escapes(a2); 361 339 362 if (starsub && (quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT))) { 340 363 ifs = getifs(); 341 364 sep[0] = ifs ? *ifs : '\0'; … … 343 366 sep[0] = ' '; 344 367 sep[1] = '\0'; 345 368 346 return (array_to_string_internal (h, p, sep, quoted)); 369 t = array_to_string (a2, sep, 0); 370 array_dispose(a2); 371 372 return t; 347 373 } 348 374 349 375 char * … … 367 393 } 368 394 369 395 if (mflags & MATCH_QUOTED) 370 array_quote (a2); 396 array_quote(a2); 397 else 398 array_quote_escapes(a2); 371 399 if (mflags & MATCH_STARSUB) { 372 400 ifs = getifs(); 373 401 sifs[0] = ifs ? *ifs : '\0'; -
array.h
diff -Naur bash-3.2.orig/array.h bash-3.2/array.h
old new 55 55 extern ARRAY_ELEMENT *array_unshift_element __P((ARRAY *)); 56 56 extern int array_shift_element __P((ARRAY *, char *)); 57 57 extern ARRAY *array_quote __P((ARRAY *)); 58 extern ARRAY *array_quote_escapes __P((ARRAY *)); 58 59 59 60 extern char *array_subrange __P((ARRAY *, arrayind_t, arrayind_t, int, int)); 60 61 extern char *array_patsub __P((ARRAY *, char *, char *, int)); -
arrayfunc.c
diff -Naur bash-3.2.orig/arrayfunc.c bash-3.2/arrayfunc.c
old new 618 618 if (expok == 0) 619 619 { 620 620 last_command_exit_value = EXECUTION_FAILURE; 621 622 top_level_cleanup (); 621 623 jump_to_top_level (DISCARD); 622 624 } 623 625 return val; -
builtins/common.c
diff -Naur bash-3.2.orig/builtins/common.c bash-3.2/builtins/common.c
old new 1 /* Copyright (C) 1987-200 5Free Software Foundation, Inc.1 /* Copyright (C) 1987-2007 Free Software Foundation, Inc. 2 2 3 3 This file is part of GNU Bash, the Bourne Again SHell. 4 4 … … 131 131 if (list) 132 132 { 133 133 builtin_error (_("too many arguments")); 134 top_level_cleanup (); 134 135 jump_to_top_level (DISCARD); 135 136 } 136 137 } … … 395 396 if (fatal) 396 397 throw_to_top_level (); 397 398 else 398 jump_to_top_level (DISCARD); 399 { 400 top_level_cleanup (); 401 jump_to_top_level (DISCARD); 402 } 399 403 } 400 404 no_args (list->next); 401 405 } … … 475 479 476 480 if (the_current_working_directory == 0) 477 481 { 482 #if defined (GETCWD_BROKEN) 483 the_current_working_directory = getcwd (0, PATH_MAX); 484 #else 478 485 the_current_working_directory = getcwd (0, 0); 486 #endif 479 487 if (the_current_working_directory == 0) 480 488 { 481 489 fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"), -
builtins/printf.def
diff -Naur bash-3.2.orig/builtins/printf.def bash-3.2/builtins/printf.def
old new 1 1 This file is printf.def, from which is created printf.c. 2 2 It implements the builtin "printf" in Bash. 3 3 4 Copyright (C) 1997-200 5Free Software Foundation, Inc.4 Copyright (C) 1997-2007 Free Software Foundation, Inc. 5 5 6 6 This file is part of GNU Bash, the Bourne Again SHell. 7 7 … … 49 49 # define INT_MIN (-2147483647-1) 50 50 #endif 51 51 52 #if defined (PREFER_STDARG) 53 # include <stdarg.h> 54 #else 55 # include <varargs.h> 56 #endif 57 52 58 #include <stdio.h> 53 59 #include <chartypes.h> 54 60 … … 64 70 #include "bashgetopt.h" 65 71 #include "common.h" 66 72 73 #if defined (PRI_MACROS_BROKEN) 74 # undef PRIdMAX 75 #endif 76 67 77 #if !defined (PRIdMAX) 68 78 # if HAVE_LONG_LONG 69 79 # define PRIdMAX "lld" … … 151 161 #define SKIP1 "#'-+ 0" 152 162 #define LENMODS "hjlLtz" 153 163 164 #ifndef HAVE_ASPRINTF 165 extern int asprintf __P((char **, const char *, ...)) __attribute__((__format__ (printf, 2, 3))); 166 #endif 167 154 168 static void printf_erange __P((char *)); 155 169 static int printstr __P((char *, char *, int, int, int)); 156 170 static int tescape __P((char *, char *, int *)); -
builtins/read.def
diff -Naur bash-3.2.orig/builtins/read.def bash-3.2/builtins/read.def
old new 127 127 WORD_LIST *list; 128 128 { 129 129 register char *varname; 130 int size, i, nr, pass_next, saw_escape, eof, opt, retval, code ;131 int input_is_tty, input_is_pipe, unbuffered_read ;130 int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2; 131 int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul; 132 132 int raw, edit, nchars, silent, have_timeout, fd; 133 133 unsigned int tmout; 134 134 intmax_t intval; 135 135 char c; 136 136 char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname; 137 char *e, *t, *t1 ;137 char *e, *t, *t1, *ps2; 138 138 struct stat tsb; 139 139 SHELL_VAR *var; 140 140 #if defined (ARRAY_VARS) … … 148 148 USE_VAR(size); 149 149 USE_VAR(i); 150 150 USE_VAR(pass_next); 151 USE_VAR(print_ps2); 151 152 USE_VAR(saw_escape); 152 153 USE_VAR(input_is_pipe); 153 154 /* USE_VAR(raw); */ … … 163 164 USE_VAR(rlind); 164 165 #endif 165 166 USE_VAR(list); 167 USE_VAR(ps2); 166 168 167 169 i = 0; /* Index into the string that we are reading. */ 168 170 raw = edit = 0; /* Not reading raw input by default. */ … … 386 388 setmode (0, O_TEXT); 387 389 #endif 388 390 389 for (eof = retval = 0;;) 391 ps2 = 0; 392 for (print_ps2 = eof = retval = 0;;) 390 393 { 391 394 #if defined (READLINE) 392 395 if (edit) … … 412 415 { 413 416 #endif 414 417 418 if (print_ps2) 419 { 420 if (ps2 == 0) 421 ps2 = get_string_value ("PS2"); 422 fprintf (stderr, "%s", ps2 ? ps2 : ""); 423 fflush (stderr); 424 print_ps2 = 0; 425 } 426 415 427 if (unbuffered_read) 416 428 retval = zread (fd, &c, 1); 417 429 else … … 440 452 { 441 453 pass_next = 0; 442 454 if (c == '\n') 443 i--; /* back up over the CTLESC */ 455 { 456 i--; /* back up over the CTLESC */ 457 if (interactive && input_is_tty && raw == 0) 458 print_ps2 = 1; 459 } 444 460 else 445 461 goto add_char; 446 462 continue; -
config-bot.h
diff -Naur bash-3.2.orig/config-bot.h bash-3.2/config-bot.h
old new 1 1 /* config-bot.h */ 2 2 /* modify settings or make new ones based on what autoconf tells us. */ 3 3 4 /* Copyright (C) 1989-200 2Free Software Foundation, Inc.4 /* Copyright (C) 1989-2007 Free Software Foundation, Inc. 5 5 6 6 This file is part of GNU Bash, the Bourne Again SHell. 7 7 … … 70 70 # define TERMIOS_MISSING 71 71 #endif 72 72 73 /* If we have a getcwd(3), but it calls popen(), #undef HAVE_GETCWD so 74 the replacement in getcwd.c will be built. */ 75 #if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN) 73 /* If we have a getcwd(3), but one that does not dynamically allocate memory, 74 #undef HAVE_GETCWD so the replacement in getcwd.c will be built. We do 75 not do this on Solaris, because their implementation of loopback mounts 76 breaks the traditional file system assumptions that getcwd uses. */ 77 #if defined (HAVE_GETCWD) && defined (GETCWD_BROKEN) && !defined (SOLARIS) 76 78 # undef HAVE_GETCWD 77 79 #endif 78 80 -
config.h.in
diff -Naur bash-3.2.orig/config.h.in bash-3.2/config.h.in
old new 1 1 /* config.h -- Configuration file for bash. */ 2 2 3 /* Copyright (C) 1987-200 6Free Software Foundation, Inc.3 /* Copyright (C) 1987-2007 Free Software Foundation, Inc. 4 4 5 5 This file is part of GNU Bash, the Bourne Again SHell. 6 6 … … 413 413 414 414 #undef HAVE_DECL_STRTOLD 415 415 416 #undef PRI_MACROS_BROKEN 417 416 418 #undef STRTOLD_BROKEN 417 419 418 420 /* Define if WCONTINUED is defined in system headers, but rejected by waitpid */ … … 1006 1008 /* Define if you have the `dcgettext' function. */ 1007 1009 #undef HAVE_DCGETTEXT 1008 1010 1011 /* Define if you have the `localeconv' function. */ 1012 #undef HAVE_LOCALECONV 1013 1009 1014 /* Define if your system has a working `malloc' function. */ 1010 1015 /* #undef HAVE_MALLOC */ 1011 1016 -
configure
diff -Naur bash-3.2.orig/configure bash-3.2/configure
old new 27316 27316 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;; 27317 27317 sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;; 27318 27318 sunos4*) LOCAL_CFLAGS=-DSunOS4 ;; 27319 solaris2.5*) LOCAL_CFLAGS=-DSunOS5 ;; 27319 solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;; 27320 solaris2*) LOCAL_CFLAGS=-DSOLARIS ;; 27320 27321 lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; 27321 27322 linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading 27322 27323 case "`uname -r`" in -
configure.in
diff -Naur bash-3.2.orig/configure.in bash-3.2/configure.in
old new 5 5 dnl 6 6 dnl Process this file with autoconf to produce a configure script. 7 7 8 # Copyright (C) 1987-200 6Free Software Foundation, Inc.8 # Copyright (C) 1987-2007 Free Software Foundation, Inc. 9 9 10 10 # This program is free software; you can redistribute it and/or modify 11 11 # it under the terms of the GNU General Public License as published by … … 991 991 sco3.2v4*) LOCAL_CFLAGS="-DMUST_UNBLOCK_CHLD -DPATH_MAX=1024" ;; 992 992 sco3.2*) LOCAL_CFLAGS=-DMUST_UNBLOCK_CHLD ;; 993 993 sunos4*) LOCAL_CFLAGS=-DSunOS4 ;; 994 solaris2.5*) LOCAL_CFLAGS=-DSunOS5 ;; 994 solaris2.5*) LOCAL_CFLAGS="-DSunOS5 -DSOLARIS" ;; 995 solaris2*) LOCAL_CFLAGS=-DSOLARIS ;; 995 996 lynxos*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;; 996 997 linux*) LOCAL_LDFLAGS=-rdynamic # allow dynamic loading 997 998 case "`uname -r`" in -
execute_cmd.c
diff -Naur bash-3.2.orig/execute_cmd.c bash-3.2/execute_cmd.c
old new 1 1 /* execute_cmd.c -- Execute a COMMAND structure. */ 2 2 3 /* Copyright (C) 1987-200 5Free Software Foundation, Inc.3 /* Copyright (C) 1987-2007 Free Software Foundation, Inc. 4 4 5 5 This file is part of GNU Bash, the Bourne Again SHell. 6 6 … … 2546 2546 arg1 = cond_expand_word (cond->left->op, 0); 2547 2547 if (arg1 == 0) 2548 2548 arg1 = nullstr; 2549 arg2 = cond_expand_word (cond->right->op, patmatch||rmatch);2549 arg2 = cond_expand_word (cond->right->op, rmatch ? 2 : (patmatch ? 1 : 0)); 2550 2550 if (arg2 == 0) 2551 2551 arg2 = nullstr; 2552 2552 … … 3050 3050 if (command_line == 0) 3051 3051 command_line = savestring (the_printed_command_except_trap); 3052 3052 3053 #if defined (PROCESS_SUBSTITUTION) 3054 if ((subshell_environment & SUBSHELL_COMSUB) && (simple_command->flags & CMD_NO_FORK) && fifos_pending() > 0) 3055 simple_command->flags &= ~CMD_NO_FORK; 3056 #endif 3057 3053 3058 execute_disk_command (words, simple_command->redirects, command_line, 3054 3059 pipe_in, pipe_out, async, fds_to_close, 3055 3060 simple_command->flags); -
bash-3.2
diff -Naur bash-3.2.orig/expr.c bash-3.2/expr.c
old new 929 929 if (interactive_shell) 930 930 { 931 931 expr_unwind (); 932 top_level_cleanup (); 932 933 jump_to_top_level (DISCARD); 933 934 } 934 935 else -
findcmd.c
diff -Naur bash-3.2.orig/findcmd.c bash-3.2/findcmd.c
old new 308 308 if (hashed_file && (posixly_correct || check_hashed_filenames)) 309 309 { 310 310 st = file_status (hashed_file); 311 if ((st ^ (FS_EXISTS | FS_EXECABLE)) != 0)311 if ((st & (FS_EXISTS|FS_EXECABLE)) != (FS_EXISTS|FS_EXECABLE)) 312 312 { 313 313 phash_remove (pathname); 314 314 free (hashed_file); -
bash-3.2
diff -Naur bash-3.2.orig/jobs.c bash-3.2/jobs.c
old new 783 783 if (jobs[js.j_firstj] == 0) 784 784 { 785 785 old = js.j_firstj++; 786 if (old >= js.j_jobslots) 787 old = js.j_jobslots - 1; 786 788 while (js.j_firstj != old) 787 789 { 788 790 if (js.j_firstj >= js.j_jobslots) 789 791 js.j_firstj = 0; 790 if (jobs[js.j_firstj] )792 if (jobs[js.j_firstj] || js.j_firstj == old) /* needed if old == 0 */ 791 793 break; 792 794 js.j_firstj++; 793 795 } … … 797 799 if (jobs[js.j_lastj] == 0) 798 800 { 799 801 old = js.j_lastj--; 802 if (old < 0) 803 old = 0; 800 804 while (js.j_lastj != old) 801 805 { 802 806 if (js.j_lastj < 0) 803 807 js.j_lastj = js.j_jobslots - 1; 804 if (jobs[js.j_lastj] )808 if (jobs[js.j_lastj] || js.j_lastj == old) /* needed if old == js.j_jobslots */ 805 809 break; 806 810 js.j_lastj--; 807 811 } … … 963 967 reap_dead_jobs (); 964 968 realloc_jobs_list (); 965 969 966 return (js.j_lastj); 970 #ifdef DEBUG 971 itrace("compact_jobs_list: returning %d", (js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0); 972 #endif 973 974 return ((js.j_lastj || jobs[js.j_lastj]) ? js.j_lastj + 1 : 0); 967 975 } 968 976 969 977 /* Delete the job at INDEX from the job list. Must be called … … 984 992 temp = jobs[job_index]; 985 993 if (temp == 0) 986 994 return; 987 if (job_index == js.j_current || job_index == js.j_previous)988 reset_current ();989 995 990 996 if ((dflags & DEL_NOBGPID) == 0) 991 997 { … … 1028 1034 js.j_firstj = js.j_lastj = 0; 1029 1035 else if (jobs[js.j_firstj] == 0 || jobs[js.j_lastj] == 0) 1030 1036 reset_job_indices (); 1037 1038 if (job_index == js.j_current || job_index == js.j_previous) 1039 reset_current (); 1031 1040 } 1032 1041 1033 1042 /* Must be called with SIGCHLD blocked. */ -
lib/readline/complete.c
diff -Naur bash-3.2.orig/lib/readline/complete.c bash-3.2/lib/readline/complete.c
old new 428 428 return (1); 429 429 if (c == 'n' || c == 'N' || c == RUBOUT) 430 430 return (0); 431 if (c == ABORT_CHAR )431 if (c == ABORT_CHAR || c < 0) 432 432 _rl_abort_internal (); 433 433 if (for_pager && (c == NEWLINE || c == RETURN)) 434 434 return (2); -
lib/readline/display.c
diff -Naur bash-3.2.orig/lib/readline/display.c bash-3.2/lib/readline/display.c
old new 561 561 wrap_offset = prompt_invis_chars_first_line = 0; 562 562 } 563 563 564 #if defined (HANDLE_MULTIBYTE) 565 #define CHECK_INV_LBREAKS() \ 566 do { \ 567 if (newlines >= (inv_lbsize - 2)) \ 568 { \ 569 inv_lbsize *= 2; \ 570 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ 571 _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \ 572 } \ 573 } while (0) 574 #else 564 575 #define CHECK_INV_LBREAKS() \ 565 576 do { \ 566 577 if (newlines >= (inv_lbsize - 2)) \ … … 569 580 inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ 570 581 } \ 571 582 } while (0) 583 #endif /* HANDLE_MULTIBYTE */ 572 584 573 585 #if defined (HANDLE_MULTIBYTE) 574 586 #define CHECK_LPOS() \ … … 1506 1518 { 1507 1519 /* Non-zero if we're increasing the number of lines. */ 1508 1520 int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; 1521 /* If col_lendiff is > 0, implying that the new string takes up more 1522 screen real estate than the old, but lendiff is < 0, meaning that it 1523 takes fewer bytes, we need to just output the characters starting 1524 from the first difference. These will overwrite what is on the 1525 display, so there's no reason to do a smart update. This can really 1526 only happen in a multibyte environment. */ 1527 if (lendiff < 0) 1528 { 1529 _rl_output_some_chars (nfd, temp); 1530 _rl_last_c_pos += _rl_col_width (nfd, 0, temp); 1531 /* If nfd begins before any invisible characters in the prompt, 1532 adjust _rl_last_c_pos to account for wrap_offset and set 1533 cpos_adjusted to let the caller know. */ 1534 if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) 1535 { 1536 _rl_last_c_pos -= wrap_offset; 1537 cpos_adjusted = 1; 1538 } 1539 return; 1540 } 1509 1541 /* Sometimes it is cheaper to print the characters rather than 1510 1542 use the terminal's capabilities. If we're growing the number 1511 1543 of lines, make sure we actually cause the new line to wrap 1512 1544 around on auto-wrapping terminals. */ 1513 if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))1545 else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) 1514 1546 { 1515 1547 /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and 1516 1548 _rl_horizontal_scroll_mode == 1, inserting the characters with … … 1586 1618 temp = nls - nfd; 1587 1619 if (temp > 0) 1588 1620 { 1621 /* If nfd begins at the prompt, or before the invisible 1622 characters in the prompt, we need to adjust _rl_last_c_pos 1623 in a multibyte locale to account for the wrap offset and 1624 set cpos_adjusted accordingly. */ 1589 1625 _rl_output_some_chars (nfd, temp); 1590 _rl_last_c_pos += _rl_col_width (nfd, 0, temp);; 1626 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1627 { 1628 _rl_last_c_pos += _rl_col_width (nfd, 0, temp); 1629 if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) 1630 { 1631 _rl_last_c_pos -= wrap_offset; 1632 cpos_adjusted = 1; 1633 } 1634 } 1635 else 1636 _rl_last_c_pos += temp; 1591 1637 } 1592 1638 } 1593 1639 /* Otherwise, print over the existing material. */ … … 1595 1641 { 1596 1642 if (temp > 0) 1597 1643 { 1644 /* If nfd begins at the prompt, or before the invisible 1645 characters in the prompt, we need to adjust _rl_last_c_pos 1646 in a multibyte locale to account for the wrap offset and 1647 set cpos_adjusted accordingly. */ 1598 1648 _rl_output_some_chars (nfd, temp); 1599 1649 _rl_last_c_pos += col_temp; /* XXX */ 1650 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1651 { 1652 if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) 1653 { 1654 _rl_last_c_pos -= wrap_offset; 1655 cpos_adjusted = 1; 1656 } 1657 } 1600 1658 } 1601 1659 lendiff = (oe - old) - (ne - new); 1602 1660 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) … … 1732 1790 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1733 1791 { 1734 1792 dpos = _rl_col_width (data, 0, new); 1735 if (dpos > prompt_last_invisible) /* XXX - don't use woff here */ 1793 /* Use NEW when comparing against the last invisible character in the 1794 prompt string, since they're both buffer indices and DPOS is a 1795 desired display position. */ 1796 if (new > prompt_last_invisible) /* XXX - don't use woff here */ 1736 1797 { 1737 1798 dpos -= woff; 1738 1799 /* Since this will be assigned to _rl_last_c_pos at the end (more … … 2380 2441 2381 2442 if (end <= start) 2382 2443 return 0; 2444 if (MB_CUR_MAX == 1 || rl_byte_oriented) 2445 return (end - start); 2383 2446 2384 2447 memset (&ps, 0, sizeof (mbstate_t)); 2385 2448 -
lib/readline/input.c
diff -Naur bash-3.2.orig/lib/readline/input.c bash-3.2/lib/readline/input.c
old new 133 133 return (0); 134 134 135 135 *key = ibuffer[pop_index++]; 136 136 #if 0 137 137 if (pop_index >= ibuffer_len) 138 #else 139 if (pop_index > ibuffer_len) 140 #endif 138 141 pop_index = 0; 139 142 140 143 return (1); … … 250 253 while (chars_avail--) 251 254 { 252 255 k = (*rl_getc_function) (rl_instream); 253 rl_stuff_char (k); 256 if (rl_stuff_char (k) == 0) 257 break; /* some problem; no more room */ 254 258 if (k == NEWLINE || k == RETURN) 255 259 break; 256 260 } … … 373 377 RL_SETSTATE (RL_STATE_INPUTPENDING); 374 378 } 375 379 ibuffer[push_index++] = key; 380 #if 0 376 381 if (push_index >= ibuffer_len) 382 #else 383 if (push_index > ibuffer_len) 384 #endif 377 385 push_index = 0; 378 386 379 387 return 1; … … 513 521 char *mbchar; 514 522 int size; 515 523 { 516 int mb_len = 0;524 int mb_len, c; 517 525 size_t mbchar_bytes_length; 518 526 wchar_t wc; 519 527 mbstate_t ps, ps_back; 520 528 521 529 memset(&ps, 0, sizeof (mbstate_t)); 522 530 memset(&ps_back, 0, sizeof (mbstate_t)); 523 531 532 mb_len = 0; 524 533 while (mb_len < size) 525 534 { 526 535 RL_SETSTATE(RL_STATE_MOREINPUT); 527 mbchar[mb_len++]= rl_read_key ();536 c = rl_read_key (); 528 537 RL_UNSETSTATE(RL_STATE_MOREINPUT); 529 538 539 if (c < 0) 540 break; 541 542 mbchar[mb_len++] = c; 543 530 544 mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps); 531 545 if (mbchar_bytes_length == (size_t)(-1)) 532 546 break; /* invalid byte sequence for the current locale */ … … 564 578 565 579 c = first; 566 580 memset (mb, 0, mlen); 567 for (i = 0; i < mlen; i++)581 for (i = 0; c >= 0 && i < mlen; i++) 568 582 { 569 583 mb[i] = (char)c; 570 584 memset (&ps, 0, sizeof (mbstate_t)); -
lib/readline/isearch.c
diff -Naur bash-3.2.orig/lib/readline/isearch.c bash-3.2/lib/readline/isearch.c
old new 327 327 rl_command_func_t *f; 328 328 329 329 f = (rl_command_func_t *)NULL; 330 331 /* Translate the keys we do something with to opcodes. */ 330 331 if (c < 0) 332 { 333 cxt->sflags |= SF_FAILED; 334 cxt->history_pos = cxt->last_found_line; 335 return -1; 336 } 337 338 /* Translate the keys we do something with to opcodes. */ 332 339 if (c >= 0 && _rl_keymap[c].type == ISFUNC) 333 340 { 334 341 f = _rl_keymap[c].function; -
lib/readline/misc.c
diff -Naur bash-3.2.orig/lib/readline/misc.c bash-3.2/lib/readline/misc.c
old new 146 146 rl_restore_prompt (); 147 147 rl_clear_message (); 148 148 RL_UNSETSTATE(RL_STATE_NUMERICARG); 149 if (key < 0) 150 return -1; 149 151 return (_rl_dispatch (key, _rl_keymap)); 150 152 } 151 153 } -
lib/readline/readline.c
diff -Naur bash-3.2.orig/lib/readline/readline.c bash-3.2/lib/readline/readline.c
old new 645 645 if ((cxt->flags & KSEQ_DISPATCHED) == 0) 646 646 { 647 647 nkey = _rl_subseq_getchar (cxt->okey); 648 if (nkey < 0) 649 { 650 _rl_abort_internal (); 651 return -1; 652 } 648 653 r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg); 649 654 cxt->flags |= KSEQ_DISPATCHED; 650 655 } -
lib/readline/text.c
diff -Naur bash-3.2.orig/lib/readline/text.c bash-3.2/lib/readline/text.c
old new 857 857 c = rl_read_key (); 858 858 RL_UNSETSTATE(RL_STATE_MOREINPUT); 859 859 860 if (c < 0) 861 return -1; 862 860 863 #if defined (HANDLE_SIGNALS) 861 864 if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) 862 865 _rl_restore_tty_signals (); … … 1520 1523 1521 1524 mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); 1522 1525 1526 if (mb_len <= 0) 1527 return -1; 1528 1523 1529 if (count < 0) 1524 1530 return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); 1525 1531 else … … 1536 1542 c = rl_read_key (); 1537 1543 RL_UNSETSTATE(RL_STATE_MOREINPUT); 1538 1544 1545 if (c < 0) 1546 return -1; 1547 1539 1548 if (count < 0) 1540 1549 return (_rl_char_search_internal (-count, bdir, c)); 1541 1550 else -
lib/readline/vi_mode.c
diff -Naur bash-3.2.orig/lib/readline/vi_mode.c bash-3.2/lib/readline/vi_mode.c
old new 886 886 RL_SETSTATE(RL_STATE_MOREINPUT); 887 887 c = rl_read_key (); 888 888 RL_UNSETSTATE(RL_STATE_MOREINPUT); 889 890 if (c < 0) 891 { 892 *nextkey = 0; 893 return -1; 894 } 895 889 896 *nextkey = c; 890 897 891 898 if (!member (c, vi_motion)) … … 902 909 RL_SETSTATE(RL_STATE_MOREINPUT); 903 910 c = rl_read_key (); /* real command */ 904 911 RL_UNSETSTATE(RL_STATE_MOREINPUT); 912 if (c < 0) 913 { 914 *nextkey = 0; 915 return -1; 916 } 905 917 *nextkey = c; 906 918 } 907 919 else if (key == c && (key == 'd' || key == 'y' || key == 'c')) … … 1224 1236 _rl_vi_callback_char_search (data) 1225 1237 _rl_callback_generic_arg *data; 1226 1238 { 1239 int c; 1227 1240 #if defined (HANDLE_MULTIBYTE) 1228 _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);1241 c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); 1229 1242 #else 1230 1243 RL_SETSTATE(RL_STATE_MOREINPUT); 1231 _rl_vi_last_search_char= rl_read_key ();1244 c = rl_read_key (); 1232 1245 RL_UNSETSTATE(RL_STATE_MOREINPUT); 1233 1246 #endif 1234 1247 1248 if (c <= 0) 1249 return -1; 1250 1251 #if !defined (HANDLE_MULTIBYTE) 1252 _rl_vi_last_search_char = c; 1253 #endif 1254 1235 1255 _rl_callback_func = 0; 1236 1256 _rl_want_redisplay = 1; 1237 1257 … … 1247 1267 rl_vi_char_search (count, key) 1248 1268 int count, key; 1249 1269 { 1270 int c; 1250 1271 #if defined (HANDLE_MULTIBYTE) 1251 1272 static char *target; 1252 1273 static int tlen; … … 1293 1314 else 1294 1315 { 1295 1316 #if defined (HANDLE_MULTIBYTE) 1296 _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); 1317 c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); 1318 if (c <= 0) 1319 return -1; 1320 _rl_vi_last_search_mblen = c; 1297 1321 #else 1298 1322 RL_SETSTATE(RL_STATE_MOREINPUT); 1299 _rl_vi_last_search_char= rl_read_key ();1323 c = rl_read_key (); 1300 1324 RL_UNSETSTATE(RL_STATE_MOREINPUT); 1325 if (c < 0) 1326 return -1; 1327 _rl_vi_last_search_char = c; 1301 1328 #endif 1302 1329 } 1303 1330 } … … 1467 1494 c = rl_read_key (); 1468 1495 RL_UNSETSTATE(RL_STATE_MOREINPUT); 1469 1496 1497 if (c < 0) 1498 return -1; 1499 1470 1500 #if defined (HANDLE_MULTIBYTE) 1471 1501 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) 1472 1502 c = _rl_read_mbstring (c, mb, mlen); … … 1485 1515 1486 1516 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); 1487 1517 1518 if (c < 0) 1519 return -1; 1520 1488 1521 _rl_callback_func = 0; 1489 1522 _rl_want_redisplay = 1; 1490 1523 … … 1516 1549 else 1517 1550 _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); 1518 1551 1552 if (c < 0) 1553 return -1; 1554 1519 1555 return (_rl_vi_change_char (count, c, mb)); 1520 1556 } 1521 1557 … … 1650 1686 ch = rl_read_key (); 1651 1687 RL_UNSETSTATE(RL_STATE_MOREINPUT); 1652 1688 1653 if (ch < 'a' || ch > 'z')1689 if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ 1654 1690 { 1655 1691 rl_ding (); 1656 1692 return -1; … … 1702 1738 rl_point = rl_mark; 1703 1739 return 0; 1704 1740 } 1705 else if (ch < 'a' || ch > 'z')1741 else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */ 1706 1742 { 1707 1743 rl_ding (); 1708 1744 return -1; -
lib/sh/snprintf.c
diff -Naur bash-3.2.orig/lib/sh/snprintf.c bash-3.2/lib/sh/snprintf.c
old new 471 471 10^x ~= r 472 472 * log_10(200) = 2; 473 473 * log_10(250) = 2; 474 * 475 * NOTE: do not call this with r == 0 -- an infinite loop results. 474 476 */ 475 477 static int 476 478 log_10(r) … … 576 578 { 577 579 integral_part[0] = '0'; 578 580 integral_part[1] = '\0'; 579 fraction_part[0] = '0'; 580 fraction_part[1] = '\0'; 581 /* The fractional part has to take the precision into account */ 582 for (ch = 0; ch < precision-1; ch++) 583 fraction_part[ch] = '0'; 584 fraction_part[ch] = '0'; 585 fraction_part[ch+1] = '\0'; 581 586 if (fract) 582 587 *fract = fraction_part; 583 588 return integral_part; … … 663 668 p->flags &= ~PF_ZEROPAD; 664 669 665 670 sd = d; /* signed for ' ' padding in base 10 */ 666 flags = (*p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0; 671 flags = 0; 672 flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0; 667 673 if (*p->pf == 'X') 668 674 flags |= FL_HEXUPPER; 669 675 … … 733 739 p->flags &= ~PF_ZEROPAD; 734 740 735 741 sd = d; /* signed for ' ' padding in base 10 */ 736 flags = (*p->pf == ' u' || *p->pf == 'U') ? FL_UNSIGNED : 0;742 flags = (*p->pf == 'x' || *p->pf == 'X' || *p->pf == 'o' || *p->pf == 'u' || *p->pf == 'U') ? FL_UNSIGNED : 0; 737 743 if (*p->pf == 'X') 738 744 flags |= FL_HEXUPPER; 739 745 … … 805 811 PUT_CHAR(*tmp, p); 806 812 tmp++; 807 813 } 814 808 815 PAD_LEFT(p); 809 816 } 810 817 … … 972 979 if ((p->flags & PF_THOUSANDS) && grouping && (t = groupnum (tmp))) 973 980 tmp = t; 974 981 982 if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0) 983 { 984 /* smash the trailing zeros unless altform */ 985 for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--) 986 tmp2[i] = '\0'; 987 if (tmp2[0] == '\0') 988 p->precision = 0; 989 } 990 975 991 /* calculate the padding. 1 for the dot */ 976 992 p->width = p->width - 977 993 ((d > 0. && p->justify == RIGHT) ? 1:0) - 978 994 ((p->flags & PF_SPACE) ? 1:0) - 979 strlen(tmp) - p->precision - 1; 995 strlen(tmp) - p->precision - 996 ((p->precision != 0 || (p->flags & PF_ALTFORM)) ? 1 : 0); /* radix char */ 980 997 PAD_RIGHT(p); 981 998 PUT_PLUS(d, p, 0.); 982 999 PUT_SPACE(d, p, 0.); … … 991 1008 if (p->precision != 0 || (p->flags & PF_ALTFORM)) 992 1009 PUT_CHAR(decpoint, p); /* put the '.' */ 993 1010 994 if ((*p->pf == 'g' || *p->pf == 'G') && (p->flags & PF_ALTFORM) == 0)995 /* smash the trailing zeros unless altform */996 for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)997 tmp2[i] = '\0';998 999 1011 for (; *tmp2; tmp2++) 1000 1012 PUT_CHAR(*tmp2, p); /* the fraction */ 1001 1013 … … 1011 1023 char *tmp, *tmp2; 1012 1024 int j, i; 1013 1025 1014 if ( chkinfnan(p, d, 1) || chkinfnan(p, d, 2))1026 if (d != 0 && (chkinfnan(p, d, 1) || chkinfnan(p, d, 2))) 1015 1027 return; /* already printed nan or inf */ 1016 1028 1017 1029 GETLOCALEDATA(decpoint, thoussep, grouping); 1018 1030 DEF_PREC(p); 1019 j = log_10(d); 1020 d = d / pow_10(j); /* get the Mantissa */ 1021 d = ROUND(d, p); 1031 if (d == 0.) 1032 j = 0; 1033 else 1034 { 1035 j = log_10(d); 1036 d = d / pow_10(j); /* get the Mantissa */ 1037 d = ROUND(d, p); 1038 } 1022 1039 tmp = dtoa(d, p->precision, &tmp2); 1023 1040 1024 1041 /* 1 for unit, 1 for the '.', 1 for 'e|E', … … 1076 1093 PUT_CHAR(*tmp, p); 1077 1094 tmp++; 1078 1095 } 1096 1079 1097 PAD_LEFT(p); 1080 1098 } 1081 1099 #endif … … 1358 1376 STAR_ARGS(data); 1359 1377 DEF_PREC(data); 1360 1378 d = GETDOUBLE(data); 1361 i = log_10(d);1379 i = (d != 0.) ? log_10(d) : -1; 1362 1380 /* 1363 1381 * for '%g|%G' ANSI: use f if exponent 1364 1382 * is in the range or [-4,p] exclusively -
parse.y
diff -Naur bash-3.2.orig/parse.y bash-3.2/parse.y
old new 1029 1029 #define PST_CMDTOKEN 0x1000 /* command token OK - unused */ 1030 1030 #define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ 1031 1031 #define PST_ASSIGNOK 0x4000 /* assignment statement ok in this context */ 1032 #define PST_REGEXP 0x8000 /* parsing an ERE/BRE as a single word */ 1032 1033 1033 1034 /* Initial size to allocate for tokens, and the 1034 1035 amount to grow them by. */ … … 2591 2592 return (character); 2592 2593 } 2593 2594 2595 if (parser_state & PST_REGEXP) 2596 goto tokword; 2597 2594 2598 /* Shell meta-characters. */ 2595 2599 if MBTEST(shellmeta (character) && ((parser_state & PST_DBLPAREN) == 0)) 2596 2600 { … … 2698 2702 if MBTEST(character == '-' && (last_read_token == LESS_AND || last_read_token == GREATER_AND)) 2699 2703 return (character); 2700 2704 2705 tokword: 2701 2706 /* Okay, if we got this far, we have to read a word. Read one, 2702 2707 and then check it against the known ones. */ 2703 2708 result = read_token_word (character); … … 2735 2740 /* itrace("parse_matched_pair: open = %c close = %c", open, close); */ 2736 2741 count = 1; 2737 2742 pass_next_character = backq_backslash = was_dollar = in_comment = 0; 2738 check_comment = (flags & P_COMMAND) && qc != ' \'' && qc != '"' && (flags & P_DQUOTE) == 0;2743 check_comment = (flags & P_COMMAND) && qc != '`' && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; 2739 2744 2740 2745 /* RFLAGS is the set of flags we want to pass to recursive calls. */ 2741 2746 rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); … … 3202 3207 if (tok == WORD && test_binop (yylval.word->word)) 3203 3208 op = yylval.word; 3204 3209 #if defined (COND_REGEXP) 3205 else if (tok == WORD && STREQ (yylval.word->word,"=~")) 3206 op = yylval.word; 3210 else if (tok == WORD && STREQ (yylval.word->word, "=~")) 3211 { 3212 op = yylval.word; 3213 parser_state |= PST_REGEXP; 3214 } 3207 3215 #endif 3208 3216 else if (tok == '<' || tok == '>') 3209 3217 op = make_word_from_token (tok); /* ( */ … … 3234 3242 3235 3243 /* rhs */ 3236 3244 tok = read_token (READ); 3245 parser_state &= ~PST_REGEXP; 3237 3246 if (tok == WORD) 3238 3247 { 3239 3248 tright = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL); … … 3367 3376 if (pass_next_character) 3368 3377 { 3369 3378 pass_next_character = 0; 3370 goto got_ character;3379 goto got_escaped_character; 3371 3380 } 3372 3381 3373 3382 cd = current_delimiter (dstack); … … 3419 3428 goto next_character; 3420 3429 } 3421 3430 3431 #ifdef COND_REGEXP 3432 /* When parsing a regexp as a single word inside a conditional command, 3433 we need to special-case characters special to both the shell and 3434 regular expressions. Right now, that is only '(' and '|'. */ /*)*/ 3435 if MBTEST((parser_state & PST_REGEXP) && (character == '(' || character == '|')) /*)*/ 3436 { 3437 if (character == '|') 3438 goto got_character; 3439 3440 push_delimiter (dstack, character); 3441 ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0); 3442 pop_delimiter (dstack); 3443 if (ttok == &matched_pair_error) 3444 return -1; /* Bail immediately. */ 3445 RESIZE_MALLOCED_BUFFER (token, token_index, ttoklen + 2, 3446 token_buffer_size, TOKEN_DEFAULT_GROW_SIZE); 3447 token[token_index++] = character; 3448 strcpy (token + token_index, ttok); 3449 token_index += ttoklen; 3450 FREE (ttok); 3451 dollar_present = all_digit_token = 0; 3452 goto next_character; 3453 } 3454 #endif /* COND_REGEXP */ 3455 3422 3456 #ifdef EXTENDED_GLOB 3423 3457 /* Parse a ksh-style extended pattern matching specification. */ 3424 if (extended_glob && PATTERN_CHAR (character))3458 if MBTEST(extended_glob && PATTERN_CHAR (character)) 3425 3459 { 3426 3460 peek_char = shell_getc (1); 3427 3461 if MBTEST(peek_char == '(') /* ) */ … … 3616 3650 3617 3651 got_character: 3618 3652 3619 all_digit_token &= DIGIT (character);3620 dollar_present |= character == '$';3621 3622 3653 if (character == CTLESC || character == CTLNUL) 3623 3654 token[token_index++] = CTLESC; 3624 3655 3656 got_escaped_character: 3657 3658 all_digit_token &= DIGIT (character); 3659 dollar_present |= character == '$'; 3660 3625 3661 token[token_index++] = character; 3626 3662 3627 3663 RESIZE_MALLOCED_BUFFER (token, token_index, 1, token_buffer_size, -
patchlevel.h
diff -Naur bash-3.2.orig/patchlevel.h bash-3.2/patchlevel.h
old new 25 25 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 26 26 looks for to find the patch level (for the sccs version string). */ 27 27 28 #define PATCHLEVEL 028 #define PATCHLEVEL 25 29 29 30 30 #endif /* _PATCHLEVEL_H_ */ -
pathexp.c
diff -Naur bash-3.2.orig/pathexp.c bash-3.2/pathexp.c
old new 1 1 /* pathexp.c -- The shell interface to the globbing library. */ 2 2 3 /* Copyright (C) 1995-200 2Free Software Foundation, Inc.3 /* Copyright (C) 1995-2007 Free Software Foundation, Inc. 4 4 5 5 This file is part of GNU Bash, the Bourne Again SHell. 6 6 … … 110 110 return (0); 111 111 } 112 112 113 /* Return 1 if C is a character that is `special' in a POSIX ERE and needs to 114 be quoted to match itself. */ 115 static inline int 116 ere_char (c) 117 int c; 118 { 119 switch (c) 120 { 121 case '.': 122 case '[': 123 case '\\': 124 case '(': 125 case ')': 126 case '*': 127 case '+': 128 case '?': 129 case '{': 130 case '|': 131 case '^': 132 case '$': 133 return 1; 134 default: 135 return 0; 136 } 137 return (0); 138 } 139 113 140 /* PATHNAME can contain characters prefixed by CTLESC; this indicates 114 141 that the character is to be quoted. We quote it here in the style 115 142 that the glob library recognizes. If flags includes QGLOB_CVTNULL, … … 142 169 { 143 170 if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/') 144 171 continue; 172 if ((qflags & QGLOB_REGEXP) && ere_char (pathname[i+1]) == 0) 173 continue; 145 174 temp[j++] = '\\'; 146 175 i++; 147 176 if (pathname[i] == '\0') -
pathexp.h
diff -Naur bash-3.2.orig/pathexp.h bash-3.2/pathexp.h
old new 1 1 /* pathexp.h -- The shell interface to the globbing library. */ 2 2 3 /* Copyright (C) 1987-200 5Free Software Foundation, Inc.3 /* Copyright (C) 1987-2007 Free Software Foundation, Inc. 4 4 5 5 This file is part of GNU Bash, the Bourne Again SHell. 6 6 … … 32 32 /* Flag values for quote_string_for_globbing */ 33 33 #define QGLOB_CVTNULL 0x01 /* convert QUOTED_NULL strings to '\0' */ 34 34 #define QGLOB_FILENAME 0x02 /* do correct quoting for matching filenames */ 35 #define QGLOB_REGEXP 0x04 /* quote an ERE for regcomp/regexec */ 35 36 36 37 #if defined (EXTENDED_GLOB) 37 38 /* Flags to OR with other flag args to strmatch() to enabled the extended -
po/ru.po
diff -Naur bash-3.2.orig/po/ru.po bash-3.2/po/ru.po
old new 12 12 "Last-Translator: Evgeniy Dushistov <dushistov@mail.ru>\n" 13 13 "Language-Team: Russian <ru@li.org>\n" 14 14 "MIME-Version: 1.0\n" 15 "Content-Type: text/plain; charset= UTF-8\n"15 "Content-Type: text/plain; charset=KOI8-R\n" 16 16 "Content-Transfer-Encoding: 8bit\n" 17 17 "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" 18 18 -
bash-3.2
diff -Naur bash-3.2.orig/sig.c bash-3.2/sig.c
old new 350 350 #undef XSIG 351 351 #undef XHANDLER 352 352 353 /* Run some of the cleanups that should be performed when we run 354 jump_to_top_level from a builtin command context. XXX - might want to 355 also call reset_parser here. */ 356 void 357 top_level_cleanup () 358 { 359 /* Clean up string parser environment. */ 360 while (parse_and_execute_level) 361 parse_and_execute_cleanup (); 362 363 #if defined (PROCESS_SUBSTITUTION) 364 unlink_fifo_list (); 365 #endif /* PROCESS_SUBSTITUTION */ 366 367 run_unwind_protects (); 368 loop_level = continuing = breaking = 0; 369 return_catch_flag = 0; 370 } 371 353 372 /* What to do when we've been interrupted, and it is safe to handle it. */ 354 373 void 355 374 throw_to_top_level () -
bash-3.2
diff -Naur bash-3.2.orig/sig.h bash-3.2/sig.h
old new 121 121 extern void initialize_signals __P((int)); 122 122 extern void initialize_terminating_signals __P((void)); 123 123 extern void reset_terminating_signals __P((void)); 124 extern void top_level_cleanup __P((void)); 124 125 extern void throw_to_top_level __P((void)); 125 126 extern void jump_to_top_level __P((int)) __attribute__((__noreturn__)); 126 127 -
subst.c
diff -Naur bash-3.2.orig/subst.c bash-3.2/subst.c
old new 4 4 /* ``Have a little faith, there's magic in the night. You ain't a 5 5 beauty, but, hey, you're alright.'' */ 6 6 7 /* Copyright (C) 1987-200 6Free Software Foundation, Inc.7 /* Copyright (C) 1987-2007 Free Software Foundation, Inc. 8 8 9 9 This file is part of GNU Bash, the Bourne Again SHell. 10 10 … … 1278 1278 { 1279 1279 if (no_longjmp_on_fatal_error == 0) 1280 1280 { /* { */ 1281 report_error ( "bad substitution: no closing `%s' in %s", "}", string);1281 report_error (_("bad substitution: no closing `%s' in %s"), "}", string); 1282 1282 last_command_exit_value = EXECUTION_FAILURE; 1283 1283 exp_jump_to_top_level (DISCARD); 1284 1284 } … … 1887 1887 sep[1] = '\0'; 1888 1888 #endif 1889 1889 1890 /* XXX -- why call quote_list if ifs == 0? we can get away without doing 1891 it now that quote_escapes quotes spaces */ 1892 #if 0 1890 1893 tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0)) 1894 #else 1895 tlist = (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) 1896 #endif 1891 1897 ? quote_list (list) 1892 1898 : list_quote_escapes (list); 1893 1899 … … 2646 2652 2647 2653 /* This needs better error handling. */ 2648 2654 /* Expand W for use as an argument to a unary or binary operator in a 2649 [[...]] expression. If SPECIAL is nonzero, this is the rhs argument2655 [[...]] expression. If SPECIAL is 1, this is the rhs argument 2650 2656 to the != or == operator, and should be treated as a pattern. In 2651 this case, we quote the string specially for the globbing code. The 2652 caller is responsible for removing the backslashes if the unquoted 2653 words is needed later. */ 2657 this case, we quote the string specially for the globbing code. If 2658 SPECIAL is 2, this is an rhs argument for the =~ operator, and should 2659 be quoted appropriately for regcomp/regexec. The caller is responsible 2660 for removing the backslashes if the unquoted word is needed later. */ 2654 2661 char * 2655 2662 cond_expand_word (w, special) 2656 2663 WORD_DESC *w; … … 2658 2665 { 2659 2666 char *r, *p; 2660 2667 WORD_LIST *l; 2668 int qflags; 2661 2669 2662 2670 if (w->word == 0 || w->word[0] == '\0') 2663 2671 return ((char *)NULL); … … 2672 2680 } 2673 2681 else 2674 2682 { 2683 qflags = QGLOB_CVTNULL; 2684 if (special == 2) 2685 qflags |= QGLOB_REGEXP; 2675 2686 p = string_list (l); 2676 r = quote_string_for_globbing (p, QGLOB_CVTNULL);2687 r = quote_string_for_globbing (p, qflags); 2677 2688 free (p); 2678 2689 } 2679 2690 dispose_words (l); … … 2916 2927 2917 2928 /* Quote escape characters in string s, but no other characters. This is 2918 2929 used to protect CTLESC and CTLNUL in variable values from the rest of 2919 the word expansion process after the variable is expanded. */ 2930 the word expansion process after the variable is expanded. If IFS is 2931 null, we quote spaces as well, just in case we split on spaces later 2932 (in the case of unquoted $@, we will eventually attempt to split the 2933 entire word on spaces). Corresponding code exists in dequote_escapes. 2934 Even if we don't end up splitting on spaces, quoting spaces is not a 2935 problem. */ 2920 2936 char * 2921 2937 quote_escapes (string) 2922 2938 char *string; … … 2924 2940 register char *s, *t; 2925 2941 size_t slen; 2926 2942 char *result, *send; 2943 int quote_spaces; 2927 2944 DECLARE_MBSTATE; 2928 2945 2929 2946 slen = strlen (string); 2930 2947 send = string + slen; 2931 2948 2949 quote_spaces = (ifs_value && *ifs_value == 0); 2932 2950 t = result = (char *)xmalloc ((slen * 2) + 1); 2933 2951 s = string; 2934 2952 2935 2953 while (*s) 2936 2954 { 2937 if (*s == CTLESC || *s == CTLNUL )2955 if (*s == CTLESC || *s == CTLNUL || (quote_spaces && *s == ' ')) 2938 2956 *t++ = CTLESC; 2939 2957 COPY_CHAR_P (t, s, send); 2940 2958 } … … 2976 2994 register char *s, *t; 2977 2995 size_t slen; 2978 2996 char *result, *send; 2997 int quote_spaces; 2979 2998 DECLARE_MBSTATE; 2980 2999 2981 3000 if (string == 0) … … 2990 3009 if (strchr (string, CTLESC) == 0) 2991 3010 return (strcpy (result, s)); 2992 3011 3012 quote_spaces = (ifs_value && *ifs_value == 0); 2993 3013 while (*s) 2994 3014 { 2995 if (*s == CTLESC && (s[1] == CTLESC || s[1] == CTLNUL ))3015 if (*s == CTLESC && (s[1] == CTLESC || s[1] == CTLNUL || (quote_spaces && s[1] == ' '))) 2996 3016 { 2997 3017 s++; 2998 3018 if (*s == '\0') … … 3954 3974 if (patspec == RP_LONG_LEFT || patspec == RP_LONG_RIGHT) 3955 3975 patstr++; 3956 3976 3957 pattern = getpattern (patstr, quoted, 1); 3977 /* Need to pass getpattern newly-allocated memory in case of expansion -- 3978 the expansion code will free the passed string on an error. */ 3979 temp1 = savestring (patstr); 3980 pattern = getpattern (temp1, quoted, 1); 3981 free (temp1); 3958 3982 3959 3983 temp1 = (char *)NULL; /* shut up gcc */ 3960 3984 switch (vtype) … … 4123 4147 nfifo = 0; 4124 4148 } 4125 4149 4150 int 4151 fifos_pending () 4152 { 4153 return nfifo; 4154 } 4155 4126 4156 static char * 4127 4157 make_named_pipe () 4128 4158 { … … 4172 4202 nfds++; 4173 4203 } 4174 4204 4205 int 4206 fifos_pending () 4207 { 4208 return 0; /* used for cleanup; not needed with /dev/fd */ 4209 } 4210 4175 4211 void 4176 4212 unlink_fifo_list () 4177 4213 { … … 4456 4492 /* Add the character to ISTRING, possibly after resizing it. */ 4457 4493 RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE); 4458 4494 4459 if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || c == CTLESC || c == CTLNUL) 4495 /* This is essentially quote_string inline */ 4496 if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) /* || c == CTLESC || c == CTLNUL */) 4497 istring[istring_index++] = CTLESC; 4498 /* Escape CTLESC and CTLNUL in the output to protect those characters 4499 from the rest of the word expansions (word splitting and globbing.) 4500 This is essentially quote_escapes inline. */ 4501 else if (c == CTLESC) 4502 istring[istring_index++] = CTLESC; 4503 else if (c == CTLNUL || (c == ' ' && (ifs_value && *ifs_value == 0))) 4460 4504 istring[istring_index++] = CTLESC; 4461 4505 4462 4506 istring[istring_index++] = c; … … 4665 4709 4666 4710 last_command_exit_value = rc; 4667 4711 rc = run_exit_trap (); 4712 #if defined (PROCESS_SUBSTITUTION) 4713 unlink_fifo_list (); 4714 #endif 4668 4715 exit (rc); 4669 4716 } 4670 4717 else … … 5546 5593 so verify_substring_values just returns the numbers specified and we 5547 5594 rely on array_subrange to understand how to deal with them). */ 5548 5595 tt = array_subrange (array_cell (v), e1, e2, starsub, quoted); 5596 #if 0 5597 /* array_subrange now calls array_quote_escapes as appropriate, so the 5598 caller no longer needs to. */ 5549 5599 if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) == 0) 5550 5600 { 5551 5601 temp = tt ? quote_escapes (tt) : (char *)NULL; 5552 5602 FREE (tt); 5553 5603 } 5554 5604 else 5605 #endif 5555 5606 temp = tt; 5556 5607 break; 5557 5608 #endif … … 5707 5758 vtype &= ~VT_STARSUB; 5708 5759 5709 5760 mflags = 0; 5761 if (patsub && *patsub == '/') 5762 { 5763 mflags |= MATCH_GLOBREP; 5764 patsub++; 5765 } 5710 5766 5711 5767 /* Malloc this because expand_string_if_necessary or one of the expansion 5712 5768 functions in its call chain may free it on a substitution error. */ … … 5741 5797 } 5742 5798 5743 5799 /* ksh93 doesn't allow the match specifier to be a part of the expanded 5744 pattern. This is an extension. */ 5800 pattern. This is an extension. Make sure we don't anchor the pattern 5801 at the beginning or end of the string if we're doing global replacement, 5802 though. */ 5745 5803 p = pat; 5746 if (pat && pat[0] == '/') 5747 { 5748 mflags |= MATCH_GLOBREP|MATCH_ANY; 5749 p++; 5750 } 5804 if (mflags & MATCH_GLOBREP) 5805 mflags |= MATCH_ANY; 5751 5806 else if (pat && pat[0] == '#') 5752 5807 { 5753 5808 mflags |= MATCH_BEG; … … 5798 5853 #if defined (ARRAY_VARS) 5799 5854 case VT_ARRAYVAR: 5800 5855 temp = array_patsub (array_cell (v), p, rep, mflags); 5856 #if 0 5857 /* Don't need to do this anymore; array_patsub calls array_quote_escapes 5858 as appropriate before adding the space separators. */ 5801 5859 if (temp && (mflags & MATCH_QUOTED) == 0) 5802 5860 { 5803 5861 tt = quote_escapes (temp); 5804 5862 free (temp); 5805 5863 temp = tt; 5806 5864 } 5865 #endif 5807 5866 break; 5808 5867 #endif 5809 5868 } … … 7607 7666 expand_no_split_dollar_star = 0; /* XXX */ 7608 7667 expanding_redir = 0; 7609 7668 7669 top_level_cleanup (); /* from sig.c */ 7670 7610 7671 jump_to_top_level (v); 7611 7672 } 7612 7673 … … 7824 7885 else if (fail_glob_expansion != 0) 7825 7886 { 7826 7887 report_error (_("no match: %s"), tlist->word->word); 7827 jump_to_top_level (DISCARD);7888 exp_jump_to_top_level (DISCARD); 7828 7889 } 7829 7890 else if (allow_null_glob_expansion == 0) 7830 7891 { -
subst.h
diff -Naur bash-3.2.orig/subst.h bash-3.2/subst.h
old new 222 222 extern char *command_substitute __P((char *, int)); 223 223 extern char *pat_subst __P((char *, char *, char *, int)); 224 224 225 extern int fifos_pending __P((void)); 225 226 extern void unlink_fifo_list __P((void)); 226 227 227 228 extern WORD_LIST *list_string_with_quotes __P((char *)); -
tests/new-exp.right
diff -Naur bash-3.2.orig/tests/new-exp.right bash-3.2/tests/new-exp.right
old new 430 430 Case06---1---A B C::--- 431 431 Case07---3---A:B:C--- 432 432 Case08---3---A:B:C--- 433 ./new-exp.tests: line 506: /${$(($#-1))}: bad substitution433 ./new-exp.tests: line 506: ${$(($#-1))}: bad substitution 434 434 argv[1] = <a> 435 435 argv[2] = <b> 436 436 argv[3] = <c> -
variables.c
diff -Naur bash-3.2.orig/variables.c bash-3.2/variables.c
old new 1821 1821 oval = value_cell (var); 1822 1822 lval = evalexp (oval, &expok); /* ksh93 seems to do this */ 1823 1823 if (expok == 0) 1824 jump_to_top_level (DISCARD); 1824 { 1825 top_level_cleanup (); 1826 jump_to_top_level (DISCARD); 1827 } 1825 1828 } 1826 1829 rval = evalexp (value, &expok); 1827 1830 if (expok == 0) 1828 jump_to_top_level (DISCARD); 1831 { 1832 top_level_cleanup (); 1833 jump_to_top_level (DISCARD); 1834 } 1829 1835 if (flags & ASS_APPEND) 1830 1836 rval += lval; 1831 1837 retval = itos (rval);
Note:
See TracBrowser
for help on using the repository browser.