bash30-016 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 3.0
  4. Patch-ID: bash30-016
  5. Bug-Reported-by: William Park <opengeometry@yahoo.ca>
  6. Bug-Reference-ID: <200411012217.iA1MHxL7031818@node1.opengeometry.net>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2004-11/msg00017.html
  8. Bug-Description:
  9. Offset from the end of array in ${var: -n} is still off by 1. Eg.
  10. x=( {0..9} )
  11. echo ${x[*]: -1} --> 8 9
  12. Patch:
  13. *** ../bash-3.0-patched/subst.c Wed Sep 8 11:07:55 2004
  14. --- bash/subst.c Tue Nov 9 16:26:59 2004
  15. ***************
  16. *** 4900,4905 ****
  17. case VT_ARRAYVAR:
  18. a = (ARRAY *)value;
  19. ! /* For arrays, the first value deals with array indices. */
  20. ! len = array_max_index (a); /* arrays index from 0 to n - 1 */
  21. break;
  22. #endif
  23. --- 4900,4906 ----
  24. case VT_ARRAYVAR:
  25. a = (ARRAY *)value;
  26. ! /* For arrays, the first value deals with array indices. Negative
  27. ! offsets count from one past the array's maximum index. */
  28. ! len = array_max_index (a) + (*e1p < 0); /* arrays index from 0 to n - 1 */
  29. break;
  30. #endif
  31. *** ../bash-3.0-patched/tests/array.tests Sat Oct 4 23:25:00 2003
  32. --- bash/tests/array.tests Tue Nov 9 16:36:29 2004
  33. ***************
  34. *** 323,327 ****
  35. echo positive offset - expect five seven
  36. echo ${av[@]:5:2}
  37. ! echo negative offset - expect five seven
  38. echo ${av[@]: -2:2}
  39. --- 323,327 ----
  40. echo positive offset - expect five seven
  41. echo ${av[@]:5:2}
  42. ! echo negative offset to unset element - expect seven
  43. echo ${av[@]: -2:2}
  44. *** ../bash-3.0-patched/tests/array.right Sat Oct 4 23:25:10 2003
  45. --- bash/tests/array.right Tue Nov 9 16:37:25 2004
  46. ***************
  47. *** 171,176 ****
  48. positive offset - expect five seven
  49. five seven
  50. ! negative offset - expect five seven
  51. ! five seven
  52. positive offset 2 - expect seven
  53. seven
  54. --- 171,176 ----
  55. positive offset - expect five seven
  56. five seven
  57. ! negative offset to unset element - expect seven
  58. ! seven
  59. positive offset 2 - expect seven
  60. seven
  61. *** ../bash-3.0-patched/patchlevel.h Tue Oct 26 17:13:29 2004
  62. --- bash/patchlevel.h Tue Nov 9 16:31:24 2004
  63. ***************
  64. *** 26,30 ****
  65. looks for to find the patch level (for the sccs version string). */
  66. ! #define PATCHLEVEL 15
  67. #endif /* _PATCHLEVEL_H_ */
  68. --- 26,30 ----
  69. looks for to find the patch level (for the sccs version string). */
  70. ! #define PATCHLEVEL 16
  71. #endif /* _PATCHLEVEL_H_ */