- Timestamp:
- Apr 10, 2009, 5:12:33 AM (15 years ago)
- Branches:
- clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 697d86d
- Parents:
- a602073
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
patches/bash-4.0-branch_update-4.patch
ra602073 re6b4db2 1 1 Submitted By: Jim Gifford (jim at cross-lfs dot org) 2 Date: 0 3-09-20092 Date: 04-09-2009 3 3 Initial Package Version: 4.0 4 4 Origin: Upstream 5 5 Upstream Status: Applied 6 Description: Contains all upstream patches up to 4.0-01 06 Description: Contains all upstream patches up to 4.0-017 7 7 8 8 diff -Naur bash-4.0.orig/arrayfunc.c bash-4.0/arrayfunc.c 9 9 --- bash-4.0.orig/arrayfunc.c 2009-01-04 11:32:21.000000000 -0800 10 +++ bash-4.0/arrayfunc.c 2009-0 3-09 15:07:05.270012850-070010 +++ bash-4.0/arrayfunc.c 2009-04-09 22:09:24.500045537 -0700 11 11 @@ -604,64 +604,7 @@ 12 12 } … … 77 77 diff -Naur bash-4.0.orig/builtins/declare.def bash-4.0/builtins/declare.def 78 78 --- bash-4.0.orig/builtins/declare.def 2009-01-04 11:32:22.000000000 -0800 79 +++ bash-4.0/builtins/declare.def 2009-0 3-09 15:07:02.561839362-070079 +++ bash-4.0/builtins/declare.def 2009-04-09 22:09:21.747868696 -0700 80 80 @@ -295,6 +295,13 @@ 81 81 subscript_start = (char *)NULL; … … 103 103 diff -Naur bash-4.0.orig/builtins/exit.def bash-4.0/builtins/exit.def 104 104 --- bash-4.0.orig/builtins/exit.def 2009-01-04 11:32:22.000000000 -0800 105 +++ bash-4.0/builtins/exit.def 2009-0 3-09 15:07:01.245754993-0700105 +++ bash-4.0/builtins/exit.def 2009-04-09 22:09:20.423784047 -0700 106 106 @@ -113,7 +113,7 @@ 107 107 for (i = stopmsg = 0; i < js.j_jobslots; i++) … … 113 113 114 114 if (stopmsg == JSTOPPED) 115 diff -Naur bash-4.0.orig/builtins/fc.def bash-4.0/builtins/fc.def 116 --- bash-4.0.orig/builtins/fc.def 2009-01-04 11:32:22.000000000 -0800 117 +++ bash-4.0/builtins/fc.def 2009-04-09 22:09:34.484684732 -0700 118 @@ -88,6 +88,7 @@ 119 extern int current_command_line_count; 120 extern int literal_history; 121 extern int posixly_correct; 122 +extern int subshell_environment, interactive_shell; 123 124 extern int unlink __P((const char *)); 125 126 @@ -172,7 +173,7 @@ 127 register int i; 128 register char *sep; 129 int numbering, reverse, listing, execute; 130 - int histbeg, histend, last_hist, retval, opt; 131 + int histbeg, histend, last_hist, retval, opt, rh; 132 FILE *stream; 133 REPL *rlist, *rl; 134 char *ename, *command, *newcom, *fcedit; 135 @@ -275,6 +276,8 @@ 136 137 fprintf (stderr, "%s\n", command); 138 fc_replhist (command); /* replace `fc -s' with command */ 139 + /* Posix says that the re-executed commands should be entered into the 140 + history. */ 141 return (parse_and_execute (command, "fc", SEVAL_NOHIST)); 142 } 143 144 @@ -293,7 +296,12 @@ 145 line was actually added (HISTIGNORE may have caused it to not be), 146 so we check hist_last_line_added. */ 147 148 - last_hist = i - remember_on_history - hist_last_line_added; 149 + /* Even though command substitution through parse_and_execute turns off 150 + remember_on_history, command substitution in a shell when set -o history 151 + has been enabled (interactive or not) should use it in the last_hist 152 + calculation as if it were on. */ 153 + rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); 154 + last_hist = i - rh - hist_last_line_added; 155 156 if (list) 157 { 158 @@ -456,7 +464,7 @@ 159 char *command; 160 HIST_ENTRY **hlist; 161 { 162 - int sign, n, clen; 163 + int sign, n, clen, rh; 164 register int i, j; 165 register char *s; 166 167 @@ -472,7 +480,12 @@ 168 line was actually added (HISTIGNORE may have caused it to not be), 169 so we check hist_last_line_added. This needs to agree with the 170 calculation of last_hist in fc_builtin above. */ 171 - i -= remember_on_history + hist_last_line_added; 172 + /* Even though command substitution through parse_and_execute turns off 173 + remember_on_history, command substitution in a shell when set -o history 174 + has been enabled (interactive or not) should use it in the last_hist 175 + calculation as if it were on. */ 176 + rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); 177 + i -= rh + hist_last_line_added; 178 179 /* No specification defaults to most recent command. */ 180 if (command == NULL) 115 181 diff -Naur bash-4.0.orig/builtins/read.def bash-4.0/builtins/read.def 116 182 --- bash-4.0.orig/builtins/read.def 2009-01-15 20:11:21.000000000 -0800 117 +++ bash-4.0/builtins/read.def 2009-0 3-09 15:07:07.890180751 -0700183 +++ bash-4.0/builtins/read.def 2009-04-09 22:09:27.380229641 -0700 118 184 @@ -369,14 +369,14 @@ 119 185 code = setjmp (alrmbuf); … … 136 202 old_alrm = set_signal_handler (SIGALRM, sigalrm); 137 203 add_unwind_protect (reset_alarm, (char *)NULL); 204 diff -Naur bash-4.0.orig/execute_cmd.c bash-4.0/execute_cmd.c 205 --- bash-4.0.orig/execute_cmd.c 2009-02-13 13:41:41.000000000 -0800 206 +++ bash-4.0/execute_cmd.c 2009-04-09 22:09:37.908905992 -0700 207 @@ -568,6 +568,7 @@ 208 209 /* Fork a subshell, turn off the subshell bit, turn off job 210 control and call execute_command () on the command again. */ 211 + line_number_for_err_trap = line_number; 212 paren_pid = make_child (savestring (make_command_string (command)), 213 asynchronous); 214 if (paren_pid == 0) 215 @@ -610,7 +611,10 @@ 216 if (user_subshell && was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS) 217 { 218 last_command_exit_value = exec_result; 219 + save_line_number = line_number; 220 + line_number = line_number_for_err_trap; 221 run_error_trap (); 222 + line_number = save_line_number; 223 } 224 225 if (user_subshell && ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS) 226 @@ -766,7 +770,9 @@ 227 if (was_error_trap && ignore_return == 0 && invert == 0 && pipe_in == NO_PIPE && pipe_out == NO_PIPE && exec_result != EXECUTION_SUCCESS) 228 { 229 last_command_exit_value = exec_result; 230 + line_number = line_number_for_err_trap; 231 run_error_trap (); 232 + line_number = save_line_number; 233 } 234 235 if (ignore_return == 0 && invert == 0 && 236 @@ -2105,6 +2111,7 @@ 237 REDIRECT *rp; 238 COMMAND *tc, *second; 239 int ignore_return, exec_result, was_error_trap, invert; 240 + volatile int save_line_number; 241 242 ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0; 243 244 @@ -2174,12 +2181,16 @@ 245 invert = (command->flags & CMD_INVERT_RETURN) != 0; 246 ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0; 247 248 + line_number_for_err_trap = line_number; 249 exec_result = execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close); 250 251 if (was_error_trap && ignore_return == 0 && invert == 0 && exec_result != EXECUTION_SUCCESS) 252 { 253 last_command_exit_value = exec_result; 254 + save_line_number = line_number; 255 + line_number = line_number_for_err_trap; 256 run_error_trap (); 257 + line_number = save_line_number; 258 } 259 260 if (ignore_return == 0 && invert == 0 && exit_immediately_on_error && exec_result != EXECUTION_SUCCESS) 261 @@ -2930,7 +2941,7 @@ 262 retval = execute_command (clauses->action); 263 } 264 while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses = clauses->next)); 265 - if ((clauses->flags & CASEPAT_TESTNEXT) == 0) 266 + if (clauses == 0 || (clauses->flags & CASEPAT_TESTNEXT) == 0) 267 EXIT_CASE (); 268 else 269 break; 138 270 diff -Naur bash-4.0.orig/parse.y bash-4.0/parse.y 139 271 --- bash-4.0.orig/parse.y 2009-01-08 05:29:12.000000000 -0800 140 +++ bash-4.0/parse.y 2009-03-09 15:07:09.194264282 -0700 272 +++ bash-4.0/parse.y 2009-04-09 22:09:39.212989803 -0700 273 @@ -1122,7 +1122,7 @@ 274 REDIRECTEE rd; 275 REDIRECT *r; 276 277 - tc = $1; 278 + tc = $1->type == cm_simple ? (COMMAND *)$1->value.Simple : $1; 279 rd.dest = 1; 280 r = make_redirection (2, r_duplicating_output, rd); 281 if (tc->redirects) 141 282 @@ -1615,10 +1615,11 @@ 142 283 { … … 160 301 161 302 /* 303 @@ -1877,7 +1879,7 @@ 304 prompt_again (); 305 ret = read_a_line (remove_quoted_newline); 306 #if defined (HISTORY) 307 - if (remember_on_history && (parser_state & PST_HEREDOC)) 308 + if (ret && remember_on_history && (parser_state & PST_HEREDOC)) 309 { 310 /* To make adding the the here-document body right, we need to rely 311 on history_delimiting_chars() returning \n for the first line of 162 312 @@ -2668,6 +2670,7 @@ 163 313 FREE (word_desc_to_read); … … 357 507 diff -Naur bash-4.0.orig/patchlevel.h bash-4.0/patchlevel.h 358 508 --- bash-4.0.orig/patchlevel.h 2009-01-04 11:32:40.000000000 -0800 359 +++ bash-4.0/patchlevel.h 2009-0 3-09 15:07:09.194264282-0700509 +++ bash-4.0/patchlevel.h 2009-04-09 22:09:39.212989803 -0700 360 510 @@ -25,6 +25,6 @@ 361 511 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh … … 363 513 364 514 -#define PATCHLEVEL 0 365 +#define PATCHLEVEL 1 0515 +#define PATCHLEVEL 17 366 516 367 517 #endif /* _PATCHLEVEL_H_ */ 368 518 diff -Naur bash-4.0.orig/pcomplete.c bash-4.0/pcomplete.c 369 519 --- bash-4.0.orig/pcomplete.c 2009-02-01 14:12:31.000000000 -0800 370 +++ bash-4.0/pcomplete.c 2009-0 3-09 15:06:58.589584858-0700520 +++ bash-4.0/pcomplete.c 2009-04-09 22:09:17.783614750 -0700 371 521 @@ -1032,6 +1032,7 @@ 372 522 cmdlist = build_arg_list (funcname, text, lwords, cw); … … 377 527 add_unwind_protect (restore_parser_state, (char *)pps); 378 528 add_unwind_protect (dispose_words, (char *)cmdlist); 529 diff -Naur bash-4.0.orig/sig.c bash-4.0/sig.c 530 --- bash-4.0.orig/sig.c 2009-01-04 11:32:41.000000000 -0800 531 +++ bash-4.0/sig.c 2009-04-09 22:09:36.612821343 -0700 532 @@ -448,6 +448,48 @@ 533 termsig_sighandler (sig) 534 int sig; 535 { 536 + /* If we get called twice with the same signal before handling it, 537 + terminate right away. */ 538 + if ( 539 +#ifdef SIGHUP 540 + sig != SIGHUP && 541 +#endif 542 +#ifdef SIGINT 543 + sig != SIGINT && 544 +#endif 545 +#ifdef SIGDANGER 546 + sig != SIGDANGER && 547 +#endif 548 +#ifdef SIGPIPE 549 + sig != SIGPIPE && 550 +#endif 551 +#ifdef SIGALRM 552 + sig != SIGALRM && 553 +#endif 554 +#ifdef SIGTERM 555 + sig != SIGTERM && 556 +#endif 557 +#ifdef SIGXCPU 558 + sig != SIGXCPU && 559 +#endif 560 +#ifdef SIGXFSZ 561 + sig != SIGXFSZ && 562 +#endif 563 +#ifdef SIGVTALRM 564 + sig != SIGVTALRM && 565 +#endif 566 +#ifdef SIGLOST 567 + sig != SIGLOST && 568 +#endif 569 +#ifdef SIGUSR1 570 + sig != SIGUSR1 && 571 +#endif 572 +#ifdef SIGUSR2 573 + sig != SIGUSR2 && 574 +#endif 575 + sig == terminating_signal) 576 + terminate_immediately = 1; 577 + 578 terminating_signal = sig; 579 580 /* XXX - should this also trigger when interrupt_immediately is set? */ 379 581 diff -Naur bash-4.0.orig/subst.c bash-4.0/subst.c 380 582 --- bash-4.0.orig/subst.c 2009-01-28 11:34:12.000000000 -0800 381 +++ bash-4.0/subst.c 2009-03-09 15:07:05.274015365 -0700 382 @@ -222,6 +222,7 @@ 583 +++ bash-4.0/subst.c 2009-04-09 22:09:33.024593378 -0700 584 @@ -85,6 +85,7 @@ 585 586 /* Flags for the `pflags' argument to param_expand() */ 587 #define PF_NOCOMSUB 0x01 /* Do not perform command substitution */ 588 +#define PF_IGNUNBOUND 0x02 /* ignore unbound vars even if -u set */ 589 590 /* These defs make it easier to use the editor. */ 591 #define LBRACE '{' 592 @@ -222,6 +223,7 @@ 383 593 static int skip_double_quoted __P((char *, size_t, int)); 384 594 static char *extract_delimited_string __P((char *, int *, char *, char *, char *, int)); … … 388 598 static char *pos_params __P((char *, int, int, int)); 389 599 390 @@ -1374,6 +1375,107 @@ 600 @@ -262,7 +264,7 @@ 601 static int chk_atstar __P((char *, int, int *, int *)); 602 static int chk_arithsub __P((const char *, int)); 603 604 -static WORD_DESC *parameter_brace_expand_word __P((char *, int, int)); 605 +static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int)); 606 static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *)); 607 static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *)); 608 static void parameter_brace_expand_error __P((char *, char *)); 609 @@ -1374,6 +1376,107 @@ 391 610 392 611 #define CQ_RETURN(x) do { no_longjmp_on_fatal_error = 0; return (x); } while (0) … … 496 715 the index of that character. START is the index into string at which we 497 716 begin. This is similar in spirit to strpbrk, but it returns an index into 717 @@ -5093,9 +5196,9 @@ 718 the shell, e.g., "@", "$", "*", etc. QUOTED, if non-zero, means that 719 NAME was found inside of a double-quoted expression. */ 720 static WORD_DESC * 721 -parameter_brace_expand_word (name, var_is_special, quoted) 722 +parameter_brace_expand_word (name, var_is_special, quoted, pflags) 723 char *name; 724 - int var_is_special, quoted; 725 + int var_is_special, quoted, pflags; 726 { 727 WORD_DESC *ret; 728 char *temp, *tt; 729 @@ -5127,7 +5230,7 @@ 730 strcpy (tt + 1, name); 731 732 ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL, 733 - (int *)NULL, (int *)NULL, 0); 734 + (int *)NULL, (int *)NULL, pflags); 735 free (tt); 736 } 737 #if defined (ARRAY_VARS) 738 @@ -5188,7 +5291,7 @@ 739 char *temp, *t; 740 WORD_DESC *w; 741 742 - w = parameter_brace_expand_word (name, var_is_special, quoted); 743 + w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND); 744 t = w->word; 745 /* Have to dequote here if necessary */ 746 if (t) 747 @@ -5205,7 +5308,7 @@ 748 if (t == 0) 749 return (WORD_DESC *)NULL; 750 751 - w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted); 752 + w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0); 753 free (t); 754 755 return w; 756 @@ -6556,7 +6659,7 @@ 757 if (want_indir) 758 tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at); 759 else 760 - tdesc = parameter_brace_expand_word (name, var_is_special, quoted); 761 + tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND); 762 763 if (tdesc) 764 { 765 @@ -6887,7 +6990,7 @@ 766 case '*': /* `$*' */ 767 list = list_rest_of_args (); 768 769 - if (list == 0 && unbound_vars_is_error) 770 + if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0) 771 { 772 uerror[0] = '$'; 773 uerror[1] = '*'; 774 @@ -6949,7 +7052,7 @@ 775 case '@': /* `$@' */ 776 list = list_rest_of_args (); 777 778 - if (list == 0 && unbound_vars_is_error) 779 + if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0) 780 { 781 uerror[0] = '$'; 782 uerror[1] = '@'; 783 diff -Naur bash-4.0.orig/trap.c bash-4.0/trap.c 784 --- bash-4.0.orig/trap.c 2009-01-16 14:07:53.000000000 -0800 785 +++ bash-4.0/trap.c 2009-04-09 22:09:37.908905992 -0700 786 @@ -755,7 +755,7 @@ 787 } 788 789 flags = SEVAL_NONINT|SEVAL_NOHIST; 790 - if (sig != DEBUG_TRAP && sig != RETURN_TRAP) 791 + if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP) 792 flags |= SEVAL_RESETLINE; 793 if (function_code == 0) 794 parse_and_execute (trap_command, tag, flags);
Note:
See TracChangeset
for help on using the changeset viewer.