bash.patch 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. This patch makes sure Bash does not segfault on empty here documents. It
  2. is derived from Gentoo Linux. The problem can be reproduced with "xargs
  3. <<< ${EMTPY_VARIABLE}".
  4. --- redir.c 2002-03-12 20:27:38.000000000 +0000
  5. +++ redir.c 2003-05-01 13:04:07.000000000 +0100
  6. @@ -263,8 +263,10 @@
  7. int herelen, n, e;
  8. herestr = expand_string_to_string (redirectee->word, 0);
  9. - herelen = strlen (herestr);
  10. + /* verify string wasnt empty */
  11. + herelen = (herestr == NULL) ? 0 : strlen (herestr);
  12. +
  13. n = write (fd, herestr, herelen);
  14. if (n == herelen)
  15. {
  16. -----------------------------------------------------------------------------
  17. This patch documents two implemented and classical command line options
  18. "-v" and "-v". It is derived from Debian GNU/Linux.
  19. --- doc/bash.1 Wed Jan 20 22:48:04 1999
  20. +++ doc/bash.1 Sun Nov 14 13:26:59 1999
  21. @@ -104,6 +104,12 @@
  22. This option allows the positional parameters to be set
  23. when invoking an interactive shell.
  24. .TP
  25. +.B \-v
  26. +Print shell input lines as they are read.
  27. +.TP
  28. +.B \-x
  29. +Print commands and their arguments as they are executed.
  30. +.TP
  31. .B \-D
  32. A list of all double-quoted strings preceded by \fB$\fP
  33. is printed on the standard ouput.
  34. -----------------------------------------------------------------------------
  35. This patch makes sure Bash does not segfault on on "shift" under "shopt
  36. -s shift_verbose". It is a null pointer dereference caused by an
  37. erroneous assumption that, when the number of arguments to shift exceeds
  38. the number of arguments available for shifting, the latter is always
  39. explicitly specified on the command line rather than left implicit at
  40. the default 1. The patch was derived from Debian GNU/Linux.
  41. --- builtins/shift.def.orig 2002-10-22 01:05:10.000000000 -0400
  42. +++ builtins/shift.def 2002-10-22 01:05:06.000000000 -0400
  43. @@ -68,7 +68,7 @@
  44. else if (times > number_of_args ())
  45. {
  46. if (print_shift_error)
  47. - sh_erange (list->word->word, "shift count");
  48. + sh_erange (list ? list->word->word : NULL, "shift count");
  49. return (EXECUTION_FAILURE);
  50. }
  51. -----------------------------------------------------------------------------
  52. This patch makes sure a signal state variable is declared "volatile" so
  53. it is consistent throughout signal handling. This patch is derived from
  54. SuSE Linux.
  55. --- quit.h
  56. +++ quit.h Wed May 2 17:38:34 2001
  57. @@ -21,8 +21,8 @@
  58. #if !defined (_QUIT_H_)
  59. #define _QUIT_H_
  60. /* Non-zero means SIGINT has already ocurred. */
  61. -extern int interrupt_state;
  62. +extern volatile int interrupt_state;
  63. /* Macro to call a great deal. SIGINT just sets above variable. When
  64. it is safe, put QUIT in the code, and the "interrupt" will take place. */
  65. --- sig.c
  66. +++ sig.c Wed May 2 17:36:17 2001
  67. @@ -57,7 +57,7 @@
  68. extern int interactive, interactive_shell, login_shell, startup_state;
  69. /* Non-zero after SIGINT. */
  70. -int interrupt_state;
  71. +volatile int interrupt_state = 0;
  72. /* The environment at the top-level R-E loop. We use this in
  73. the case of error return. */
  74. @@ -69,7 +69,7 @@
  75. #endif /* JOB_CONTROL */
  76. /* When non-zero, we throw_to_top_level (). */
  77. -int interrupt_immediately = 0;
  78. +volatile int interrupt_immediately = 0;
  79. static void initialize_shell_signals ();
  80. -----------------------------------------------------------------------------
  81. This patch adds an explicit recognition for terminal sequence "kD" to be
  82. "Delete" key. This is derived from Debian GNU/Linux and SuSE Linux.
  83. --- lib/readline/terminal.c
  84. +++ lib/readline/terminal.c Thu Jul 18 14:34:00 2002
  85. @@ -145,6 +145,9 @@
  86. static char *_rl_term_kH;
  87. static char *_rl_term_at7; /* @7 */
  88. +/* The key sequence sent by the Delete key, if any. */
  89. +static char *_rl_term_kD;
  90. +
  91. /* Insert key */
  92. static char *_rl_term_kI;
  93. @@ -313,6 +316,7 @@
  94. { "ei", &_rl_term_ei },
  95. { "ic", &_rl_term_ic },
  96. { "im", &_rl_term_im },
  97. + { "kD", &_rl_term_kD }, /* delete */
  98. { "kH", &_rl_term_kH }, /* home down ?? */
  99. { "kI", &_rl_term_kI }, /* insert */
  100. { "kd", &_rl_term_kd },
  101. @@ -496,6 +500,7 @@
  102. _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */
  103. _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line); /* End */
  104. + _rl_bind_if_unbound (_rl_term_kD, rl_delete); /* Delete */
  105. _rl_keymap = xkeymap;
  106. }
  107. -----------------------------------------------------------------------------
  108. This patch makes sure Bash does not segfault on a particular error.
  109. It is derived from RedHat Linux.
  110. --- builtins/common.c.warnings 2003-03-25 17:48:02.000000000 +0000
  111. +++ builtins/common.c 2003-03-25 17:49:03.000000000 +0000
  112. @@ -244,7 +244,7 @@
  113. char *s;
  114. {
  115. if (s)
  116. - builtin_error ("%s: no job control");
  117. + builtin_error ("%s: no job control", s);
  118. else
  119. builtin_error ("no job control");
  120. }
  121. -----------------------------------------------------------------------------
  122. This adds the OpenPKG packaging brand.
  123. Index: version.c
  124. --- version.c.orig 2002-04-03 15:49:19.000000000 +0200
  125. +++ version.c 2003-10-06 17:23:18.000000000 +0200
  126. @@ -63,7 +63,7 @@
  127. show_shell_version (extended)
  128. int extended;
  129. {
  130. - printf ("GNU bash, version %s (%s)\n", shell_version_string (), MACHTYPE);
  131. + printf ("GNU bash, version %s (%s) [@l_openpkg_release@]\n", shell_version_string (), MACHTYPE);
  132. if (extended)
  133. printf ("Copyright (C) 2002 Free Software Foundation, Inc.\n");
  134. }
  135. -----------------------------------------------------------------------------
  136. Port to HP-UX 11i and similar less smart platforms.
  137. Index: configure
  138. --- configure.orig 2002-07-16 15:31:47.000000000 +0200
  139. +++ configure 2004-06-07 10:31:26.000000000 +0200
  140. @@ -1146,6 +1146,7 @@
  141. *-beos*) opt_bash_malloc=no ;; # they say it's suitable
  142. *-cygwin*) opt_bash_malloc=no ;; # Cygnus's CYGWIN environment
  143. *-opennt*|*-interix*) opt_bash_malloc=no ;; # Interix, now owned by Microsoft
  144. +*-hpux*) opt_bash_malloc=no ;; # HP HP-UX
  145. esac
  146. # memory scrambling on free()
  147. @@ -1211,7 +1212,7 @@
  148. else
  149. MALLOC_LIB=
  150. - MALLOC_LIBRARY=
  151. + MALLOC_LIBRARY=dummy
  152. MALLOC_LDFLAGS=
  153. MALLOC_DEP=
  154. fi
  155. Index: mksyntax.c
  156. --- mksyntax.c.orig 2002-02-07 15:32:28.000000000 +0100
  157. +++ mksyntax.c 2004-06-04 11:53:19.000000000 +0200
  158. @@ -128,7 +128,11 @@
  159. switch (i)
  160. {
  161. +#if defined(__STDC__)
  162. case '\a': xbuf[1] = 'a'; break;
  163. +#else
  164. + case 7: xbuf[1] = 'a'; break;
  165. +#endif
  166. case '\v': xbuf[1] = 'v'; break;
  167. case '\b': xbuf[1] = 'b'; break;
  168. case '\f': xbuf[1] = 'f'; break;
  169. Index: syntax.h
  170. --- syntax.h.orig 2002-02-25 17:52:37.000000000 +0100
  171. +++ syntax.h 2004-06-04 11:53:49.000000000 +0200
  172. @@ -21,6 +21,8 @@
  173. #ifndef _SYNTAX_H_
  174. #define _SYNTAX_H_
  175. +#include "config.h"
  176. +
  177. /* Defines for use by mksyntax.c */
  178. #define slashify_in_quotes "\\`$\"\n"
  179. Index: builtins/printf.def
  180. --- builtins/printf.def.orig 2002-05-13 20:36:04.000000000 +0200
  181. +++ builtins/printf.def 2004-06-04 11:57:44.000000000 +0200
  182. @@ -114,7 +114,7 @@
  183. static intmax_t getintmax __P((void));
  184. static uintmax_t getuintmax __P((void));
  185. -#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD
  186. +#if defined (HAVE_LONG_DOUBLE) && HAVE_DECL_STRTOLD && !defined(HPUX)
  187. typedef long double floatmax_t;
  188. # define FLOATMAX_CONV "L"
  189. # define strtofltmax strtold