bash32-020 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 3.2
  4. Patch-ID: bash32-020
  5. Bug-Reported-by: Ian A Watson <WATSON_IAN_A@LILLY.COM>
  6. Bug-Reference-ID: <OFEC551808.69D02C7F-ON8525729A.0045708D-8525729A.0046150B@EliLilly.lilly.com>
  7. Bug-Reference-URL:
  8. Bug-Description:
  9. In some cases of error processing, a jump back to the top-level processing
  10. loop from a builtin command would leave the shell in an inconsistent state.
  11. Patch:
  12. *** ../bash-3.2-patched/sig.c Wed Jan 25 14:57:59 2006
  13. --- bash-3.2/sig.c Sat Mar 10 11:11:30 2007
  14. ***************
  15. *** 351,354 ****
  16. --- 351,373 ----
  17. #undef XHANDLER
  18. + /* Run some of the cleanups that should be performed when we run
  19. + jump_to_top_level from a builtin command context. XXX - might want to
  20. + also call reset_parser here. */
  21. + void
  22. + top_level_cleanup ()
  23. + {
  24. + /* Clean up string parser environment. */
  25. + while (parse_and_execute_level)
  26. + parse_and_execute_cleanup ();
  27. +
  28. + #if defined (PROCESS_SUBSTITUTION)
  29. + unlink_fifo_list ();
  30. + #endif /* PROCESS_SUBSTITUTION */
  31. +
  32. + run_unwind_protects ();
  33. + loop_level = continuing = breaking = 0;
  34. + return_catch_flag = 0;
  35. + }
  36. +
  37. /* What to do when we've been interrupted, and it is safe to handle it. */
  38. void
  39. *** ../bash-3.2-patched/sig.h Wed Jan 25 14:50:27 2006
  40. --- bash-3.2/sig.h Sat Mar 10 11:14:18 2007
  41. ***************
  42. *** 122,125 ****
  43. --- 122,126 ----
  44. extern void initialize_terminating_signals __P((void));
  45. extern void reset_terminating_signals __P((void));
  46. + extern void top_level_cleanup __P((void));
  47. extern void throw_to_top_level __P((void));
  48. extern void jump_to_top_level __P((int)) __attribute__((__noreturn__));
  49. *** ../bash-3.2-patched/builtins/common.c Tue Apr 3 16:47:13 2007
  50. --- bash-3.2/builtins/common.c Mon Apr 30 15:01:33 2007
  51. ***************
  52. *** 132,135 ****
  53. --- 132,136 ----
  54. {
  55. builtin_error (_("too many arguments"));
  56. + top_level_cleanup ();
  57. jump_to_top_level (DISCARD);
  58. }
  59. ***************
  60. *** 396,400 ****
  61. throw_to_top_level ();
  62. else
  63. ! jump_to_top_level (DISCARD);
  64. }
  65. no_args (list->next);
  66. --- 410,417 ----
  67. throw_to_top_level ();
  68. else
  69. ! {
  70. ! top_level_cleanup ();
  71. ! jump_to_top_level (DISCARD);
  72. ! }
  73. }
  74. no_args (list->next);
  75. *** ../bash-3.2-patched/subst.c Tue Apr 3 16:47:19 2007
  76. --- bash-3.2/subst.c Tue Jul 17 09:45:11 2007
  77. ***************
  78. *** 1279,1283 ****
  79. if (no_longjmp_on_fatal_error == 0)
  80. { /* { */
  81. ! report_error ("bad substitution: no closing `%s' in %s", "}", string);
  82. last_command_exit_value = EXECUTION_FAILURE;
  83. exp_jump_to_top_level (DISCARD);
  84. --- 1290,1294 ----
  85. if (no_longjmp_on_fatal_error == 0)
  86. { /* { */
  87. ! report_error (_("bad substitution: no closing `%s' in %s"), "}", string);
  88. last_command_exit_value = EXECUTION_FAILURE;
  89. exp_jump_to_top_level (DISCARD);
  90. ***************
  91. *** 7662,7665 ****
  92. --- 7706,7711 ----
  93. expand_no_split_dollar_star = 0; /* XXX */
  94. expanding_redir = 0;
  95. +
  96. + top_level_cleanup (); /* from sig.c */
  97. jump_to_top_level (v);
  98. ***************
  99. *** 7880,7884 ****
  100. {
  101. report_error (_("no match: %s"), tlist->word->word);
  102. ! jump_to_top_level (DISCARD);
  103. }
  104. else if (allow_null_glob_expansion == 0)
  105. --- 7927,7931 ----
  106. {
  107. report_error (_("no match: %s"), tlist->word->word);
  108. ! exp_jump_to_top_level (DISCARD);
  109. }
  110. else if (allow_null_glob_expansion == 0)
  111. *** ../bash-3.2-patched/arrayfunc.c Thu Jul 27 09:37:59 2006
  112. --- bash-3.2/arrayfunc.c Thu May 31 11:55:46 2007
  113. ***************
  114. *** 619,622 ****
  115. --- 619,624 ----
  116. {
  117. last_command_exit_value = EXECUTION_FAILURE;
  118. +
  119. + top_level_cleanup ();
  120. jump_to_top_level (DISCARD);
  121. }
  122. *** ../bash-3.2-patched/expr.c Wed Dec 28 17:47:03 2005
  123. --- bash-3.2/expr.c Tue Apr 24 14:17:59 2007
  124. ***************
  125. *** 930,933 ****
  126. --- 930,934 ----
  127. {
  128. expr_unwind ();
  129. + top_level_cleanup ();
  130. jump_to_top_level (DISCARD);
  131. }
  132. *** ../bash-3.2-patched/variables.c Fri Sep 8 13:33:32 2006
  133. --- bash-3.2/variables.c Tue Jul 17 09:54:59 2007
  134. ***************
  135. *** 1822,1830 ****
  136. lval = evalexp (oval, &expok); /* ksh93 seems to do this */
  137. if (expok == 0)
  138. ! jump_to_top_level (DISCARD);
  139. }
  140. rval = evalexp (value, &expok);
  141. if (expok == 0)
  142. ! jump_to_top_level (DISCARD);
  143. if (flags & ASS_APPEND)
  144. rval += lval;
  145. --- 1855,1869 ----
  146. lval = evalexp (oval, &expok); /* ksh93 seems to do this */
  147. if (expok == 0)
  148. ! {
  149. ! top_level_cleanup ();
  150. ! jump_to_top_level (DISCARD);
  151. ! }
  152. }
  153. rval = evalexp (value, &expok);
  154. if (expok == 0)
  155. ! {
  156. ! top_level_cleanup ();
  157. ! jump_to_top_level (DISCARD);
  158. ! }
  159. if (flags & ASS_APPEND)
  160. rval += lval;
  161. *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006
  162. --- bash-3.2/patchlevel.h Mon Oct 16 14:22:54 2006
  163. ***************
  164. *** 26,30 ****
  165. looks for to find the patch level (for the sccs version string). */
  166. ! #define PATCHLEVEL 19
  167. #endif /* _PATCHLEVEL_H_ */
  168. --- 26,30 ----
  169. looks for to find the patch level (for the sccs version string). */
  170. ! #define PATCHLEVEL 20
  171. #endif /* _PATCHLEVEL_H_ */