0002-bash50-002.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. From https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-002
  2. Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
  3. BASH PATCH REPORT
  4. =================
  5. Bash-Release: 5.0
  6. Patch-ID: bash50-002
  7. Bug-Reported-by: Ante Peric <synthmeat@gmail.com>
  8. Bug-Reference-ID: <B7E3B567-2467-4F7B-B6B9-CA4E75A9C93F@gmail.com>
  9. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00095.html
  10. Bug-Description:
  11. When an alias value ends with an unquoted literal tab (not part of a quoted
  12. string or comment), alias expansion cannot correctly detect the end of the
  13. alias value after expanding it.
  14. Patch (apply with `patch -p0'):
  15. *** ../bash-5.0/parser.h 2018-12-28 19:11:18.000000000 -0500
  16. --- b/parser.h 2019-01-11 15:13:03.000000000 -0500
  17. ***************
  18. *** 48,51 ****
  19. --- 48,52 ----
  20. #define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
  21. #define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
  22. + #define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
  23. /* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
  24. *** ../bash-5.0/parse.y 2019-01-02 13:57:34.000000000 -0500
  25. --- b/parse.y 2019-01-14 08:23:31.000000000 -0500
  26. ***************
  27. *** 2558,2567 ****
  28. pushed_string_list->flags != PSH_DPAREN &&
  29. (parser_state & PST_COMMENT) == 0 &&
  30. shell_input_line_index > 0 &&
  31. ! shell_input_line[shell_input_line_index-1] != ' ' &&
  32. shell_input_line[shell_input_line_index-1] != '\n' &&
  33. shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
  34. (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
  35. {
  36. return ' '; /* END_ALIAS */
  37. }
  38. --- 2558,2569 ----
  39. pushed_string_list->flags != PSH_DPAREN &&
  40. (parser_state & PST_COMMENT) == 0 &&
  41. + (parser_state & PST_ENDALIAS) == 0 && /* only once */
  42. shell_input_line_index > 0 &&
  43. ! shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
  44. shell_input_line[shell_input_line_index-1] != '\n' &&
  45. shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
  46. (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
  47. {
  48. + parser_state |= PST_ENDALIAS;
  49. return ' '; /* END_ALIAS */
  50. }
  51. ***************
  52. *** 2572,2575 ****
  53. --- 2574,2578 ----
  54. if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
  55. {
  56. + parser_state &= ~PST_ENDALIAS;
  57. pop_string ();
  58. uc = shell_input_line[shell_input_line_index];
  59. *** ../bash-5.0/y.tab.c 2019-01-02 13:57:43.000000000 -0500
  60. --- b/y.tab.c 2019-01-14 08:39:23.000000000 -0500
  61. ***************
  62. *** 4874,4883 ****
  63. pushed_string_list->flags != PSH_DPAREN &&
  64. (parser_state & PST_COMMENT) == 0 &&
  65. shell_input_line_index > 0 &&
  66. ! shell_input_line[shell_input_line_index-1] != ' ' &&
  67. shell_input_line[shell_input_line_index-1] != '\n' &&
  68. shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
  69. (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
  70. {
  71. return ' '; /* END_ALIAS */
  72. }
  73. --- 4874,4885 ----
  74. pushed_string_list->flags != PSH_DPAREN &&
  75. (parser_state & PST_COMMENT) == 0 &&
  76. + (parser_state & PST_ENDALIAS) == 0 && /* only once */
  77. shell_input_line_index > 0 &&
  78. ! shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
  79. shell_input_line[shell_input_line_index-1] != '\n' &&
  80. shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
  81. (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
  82. {
  83. + parser_state |= PST_ENDALIAS;
  84. return ' '; /* END_ALIAS */
  85. }
  86. ***************
  87. *** 4888,4891 ****
  88. --- 4890,4894 ----
  89. if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
  90. {
  91. + parser_state &= ~PST_ENDALIAS;
  92. pop_string ();
  93. uc = shell_input_line[shell_input_line_index];
  94. *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
  95. --- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
  96. ***************
  97. *** 26,30 ****
  98. looks for to find the patch level (for the sccs version string). */
  99. ! #define PATCHLEVEL 1
  100. #endif /* _PATCHLEVEL_H_ */
  101. --- 26,30 ----
  102. looks for to find the patch level (for the sccs version string). */
  103. ! #define PATCHLEVEL 2
  104. #endif /* _PATCHLEVEL_H_ */