bash31-017 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 3.1
  4. Patch-ID: bash31-017
  5. Bug-Reported-by: syphir@syphir.sytes.net
  6. Bug-Reference-ID: <442421F5.3010105@syphir.sytes.net>
  7. Bug-Reference-URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=358831
  8. Bug-Description:
  9. Array expansion fails with an arithmetic syntax error when the subscript
  10. appears within double quotes. For example: ${a["4"]}.
  11. Patch:
  12. *** bash-3.1/subst.c Wed Apr 12 08:47:08 2006
  13. --- bash-3.1/subst.c Wed Apr 12 08:49:02 2006
  14. ***************
  15. *** 2576,2579 ****
  16. --- 2576,2586 ----
  17. }
  18. + char *
  19. + expand_arith_string (string, quoted)
  20. + char *string;
  21. + {
  22. + return (expand_string_if_necessary (string, quoted, expand_string));
  23. + }
  24. +
  25. #if defined (COND_COMMAND)
  26. /* Just remove backslashes in STRING. Returns a new string. */
  27. ***************
  28. *** 5249,5253 ****
  29. t = (char *)0;
  30. ! temp1 = expand_string_if_necessary (substr, Q_DOUBLE_QUOTES, expand_string);
  31. *e1p = evalexp (temp1, &expok);
  32. free (temp1);
  33. --- 5256,5260 ----
  34. t = (char *)0;
  35. ! temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES);
  36. *e1p = evalexp (temp1, &expok);
  37. free (temp1);
  38. ***************
  39. *** 5294,5298 ****
  40. t++;
  41. temp2 = savestring (t);
  42. ! temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string);
  43. free (temp2);
  44. t[-1] = ':';
  45. --- 5301,5305 ----
  46. t++;
  47. temp2 = savestring (t);
  48. ! temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES);
  49. free (temp2);
  50. t[-1] = ':';
  51. ***************
  52. *** 6436,6440 ****
  53. /* Expand variables found inside the expression. */
  54. ! temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string);
  55. free (temp2);
  56. --- 6443,6447 ----
  57. /* Expand variables found inside the expression. */
  58. ! temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES);
  59. free (temp2);
  60. ***************
  61. *** 6478,6482 ****
  62. /* Do initial variable expansion. */
  63. ! temp1 = expand_string_if_necessary (temp, Q_DOUBLE_QUOTES, expand_string);
  64. goto arithsub;
  65. --- 6485,6489 ----
  66. /* Do initial variable expansion. */
  67. ! temp1 = expand_arith_string (temp, Q_DOUBLE_QUOTES);
  68. goto arithsub;
  69. *** bash-3.1/subst.h Sun Nov 7 15:12:28 2004
  70. --- bash-3.1/subst.h Mon Mar 27 09:10:38 2006
  71. ***************
  72. *** 152,155 ****
  73. --- 152,158 ----
  74. extern char *expand_assignment_string_to_string __P((char *, int));
  75. + /* Expand an arithmetic expression string */
  76. + extern char *expand_arith_string __P((char *, int));
  77. +
  78. /* De-quoted quoted characters in STRING. */
  79. extern char *dequote_string __P((char *));
  80. *** bash-3.1/arrayfunc.c Mon Jul 4 20:25:58 2005
  81. --- bash-3.1/arrayfunc.c Mon Mar 27 09:10:47 2006
  82. ***************
  83. *** 593,601 ****
  84. strncpy (exp, s, len - 1);
  85. exp[len - 1] = '\0';
  86. ! #if 0
  87. ! t = expand_string_to_string (exp, 0);
  88. ! #else
  89. ! t = expand_string_to_string (exp, Q_DOUBLE_QUOTES);
  90. ! #endif
  91. this_command_name = (char *)NULL;
  92. val = evalexp (t, &expok);
  93. --- 591,595 ----
  94. strncpy (exp, s, len - 1);
  95. exp[len - 1] = '\0';
  96. ! t = expand_arith_string (exp, 0);
  97. this_command_name = (char *)NULL;
  98. val = evalexp (t, &expok);
  99. *** bash-3.1/patchlevel.h Wed Jul 20 13:58:20 2005
  100. --- bash-3.1/patchlevel.h Wed Dec 7 13:48:42 2005
  101. ***************
  102. *** 26,30 ****
  103. looks for to find the patch level (for the sccs version string). */
  104. ! #define PATCHLEVEL 16
  105. #endif /* _PATCHLEVEL_H_ */
  106. --- 26,30 ----
  107. looks for to find the patch level (for the sccs version string). */
  108. ! #define PATCHLEVEL 17
  109. #endif /* _PATCHLEVEL_H_ */